aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/org/team.go
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-04-03 16:42:38 +0800
committerGitHub <noreply@github.com>2023-04-03 16:42:38 +0800
commitd67e40684f43b0eb744cad26e0265002f033dbc3 (patch)
tree5a930a4691124ae0c4114e8895966ac380d4f3a0 /routers/api/v1/org/team.go
parentca905b82df7f1d2a823d8df4448d485e5902876d (diff)
downloadgitea-d67e40684f43b0eb744cad26e0265002f033dbc3.tar.gz
gitea-d67e40684f43b0eb744cad26e0265002f033dbc3.zip
Improve LoadUnitConfig to handle invalid or duplicate units (#23736)
The old code just parses an invalid key to `TypeInvalid` and uses it as normal, and duplicate keys will be kept. So this PR will ignore invalid key and log warning and also deduplicate valid units.
Diffstat (limited to 'routers/api/v1/org/team.go')
-rw-r--r--routers/api/v1/org/team.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 0c6926759a..597f846206 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -135,7 +135,7 @@ func GetTeam(ctx *context.APIContext) {
}
func attachTeamUnits(team *organization.Team, units []string) {
- unitTypes := unit_model.FindUnitTypes(units...)
+ unitTypes, _ := unit_model.FindUnitTypes(units...)
team.Units = make([]*organization.TeamUnit, 0, len(units))
for _, tp := range unitTypes {
team.Units = append(team.Units, &organization.TeamUnit{