File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments