mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-31 22:45:48 +02:00
improvements
This commit is contained in:
@@ -39,6 +39,10 @@ func (vt VisibleType) IsPrivate() bool {
|
||||
return vt == VisibleTypePrivate
|
||||
}
|
||||
|
||||
func (vt VisibleType) IsValid() bool {
|
||||
return vt.String() != ""
|
||||
}
|
||||
|
||||
// VisibilityString provides the mode string of the visibility type (public, limited, private)
|
||||
func (vt VisibleType) String() string {
|
||||
for k, v := range VisibilityModes {
|
||||
@@ -56,3 +60,10 @@ func ExtractKeysFromMapString(in map[string]VisibleType) (keys []string) {
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func ConvertStringToVisibleType(s string) VisibleType {
|
||||
if vt, ok := VisibilityModes[s]; ok {
|
||||
return vt
|
||||
}
|
||||
return VisibleType(-1) // Invalid type
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user