1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-19 08:48:37 +00:00

Fix create team, update team missing units (#5188)

This commit is contained in:
Lunny Xiao
2018-11-11 03:45:32 +08:00
committed by techknowlogick
parent d487a76ee2
commit b3000ae623
7 changed files with 128 additions and 2 deletions

View File

@@ -4,6 +4,10 @@
package models
import (
"strings"
)
// UnitType is Unit's Type
type UnitType int
@@ -137,3 +141,16 @@ var (
UnitTypeExternalWiki: UnitExternalWiki,
}
)
// FindUnitTypes give the unit key name and return unit
func FindUnitTypes(nameKeys ...string) (res []UnitType) {
for _, key := range nameKeys {
for t, u := range Units {
if strings.EqualFold(key, u.NameKey) {
res = append(res, t)
break
}
}
}
return
}