mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 16:30:15 +00:00
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.
This commit is contained in:
parent
ca905b82df
commit
d67e40684f
3 changed files with 77 additions and 17 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue