diff --git a/modules/structs/visible_type.go b/modules/structs/visible_type.go index 45af941aa05..b5ff353b876 100644 --- a/modules/structs/visible_type.go +++ b/modules/structs/visible_type.go @@ -39,10 +39,6 @@ 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 { diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fe4b188243f..07b5a3ed569 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2844,7 +2844,6 @@ settings.permission = Permissions settings.repoadminchangeteam = Repository admin can add and remove access for teams settings.visibility = Visibility settings.change_visibility = Change Visibility -settings.invalid_visibility = The new visibility is not valid. settings.change_visibility_notices_1 = If the organization is converted to private, the repository stars will be removed and cannot be restored. settings.change_visibility_notices_2 = Non-members will lose access to the organization’s repositories if visibility is changed to private. settings.change_visibility_success = The visibility of organization %s has been successfully changed. diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index cef0a66e143..fe585b3a00b 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -233,8 +233,8 @@ func SettingsRenamePost(ctx *context.Context) { // SettingsChangeVisibilityPost response for change organization visibility func SettingsChangeVisibilityPost(ctx *context.Context) { - visibility := structs.VisibilityModes[ctx.FormString("visibility")] - if !visibility.IsValid() { + visibility, ok := structs.VisibilityModes[ctx.FormString("visibility")] + if !ok { ctx.Flash.Error(ctx.Tr("invalid_data", visibility)) ctx.JSONRedirect(setting.AppSubURL + "/org/" + url.PathEscape(ctx.Org.Organization.Name) + "/settings") return