1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Return nicer error for ForcePrivate (#17971)

This commit is contained in:
zeripath
2021-12-14 05:08:09 +00:00
committed by GitHub
parent 8e9140dd69
commit b4782e24d2
2 changed files with 2 additions and 1 deletions

View File

@@ -144,7 +144,7 @@ func SettingsPost(ctx *context.Context) {
visibilityChanged := repo.IsPrivate != form.Private
// when ForcePrivate enabled, you could change public repo to private, but only admin users can change private to public
if visibilityChanged && setting.Repository.ForcePrivate && !form.Private && !ctx.User.IsAdmin {
ctx.ServerError("Force Private enabled", errors.New("cannot change private repository to public"))
ctx.RenderWithErr(ctx.Tr("form.repository_force_private"), tplSettingsOptions, form)
return
}