Skip to content

Commit b591e74

Browse files
committed
remove visibility interaction in update action
1 parent 0586ab6 commit b591e74

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Diff for: routers/web/repo/setting/setting.go

+7-9
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,7 @@ func SettingsPost(ctx *context.Context) {
170170
form.Private = repo.BaseRepo.IsPrivate || repo.BaseRepo.Owner.Visibility == structs.VisibleTypePrivate
171171
}
172172

173-
visibilityChanged := repo.IsPrivate != form.Private
174-
// when ForcePrivate enabled, you could change public repo to private, but only admin users can change private to public
175-
if visibilityChanged && setting.Repository.ForcePrivate && !form.Private && !ctx.Doer.IsAdmin {
176-
ctx.RenderWithErr(ctx.Tr("form.repository_force_private"), tplSettingsOptions, form)
177-
return
178-
}
179-
180-
repo.IsPrivate = form.Private
181-
if err := repo_service.UpdateRepository(ctx, repo, visibilityChanged); err != nil {
173+
if err := repo_service.UpdateRepository(ctx, repo, false); err != nil {
182174
ctx.ServerError("UpdateRepository", err)
183175
return
184176
}
@@ -949,6 +941,12 @@ func SettingsPost(ctx *context.Context) {
949941

950942
var err error
951943

944+
// when ForcePrivate enabled, you could change public repo to private, but only admin users can change private to public
945+
if setting.Repository.ForcePrivate && repo.IsPrivate && !ctx.Doer.IsAdmin {
946+
ctx.RenderWithErr(ctx.Tr("form.repository_force_private"), tplSettingsOptions, form)
947+
return
948+
}
949+
952950
if repo.IsPrivate {
953951
err = repo_service.MakeRepoPublic(ctx, repo)
954952
} else {

0 commit comments

Comments
 (0)