File tree 1 file changed +7
-9
lines changed
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) {
170
170
form .Private = repo .BaseRepo .IsPrivate || repo .BaseRepo .Owner .Visibility == structs .VisibleTypePrivate
171
171
}
172
172
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 {
182
174
ctx .ServerError ("UpdateRepository" , err )
183
175
return
184
176
}
@@ -949,6 +941,12 @@ func SettingsPost(ctx *context.Context) {
949
941
950
942
var err error
951
943
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
+
952
950
if repo .IsPrivate {
953
951
err = repo_service .MakeRepoPublic (ctx , repo )
954
952
} else {
You can’t perform that action at this time.
0 commit comments