mirror of
https://github.com/go-gitea/gitea
synced 2025-07-14 14:37:20 +00:00
Fix visibility of forked public repos from private orgs (#11717)
* Fix visibility of forked public repos from private orgs * update forks visibility when org visibility is changed Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
committed by
GitHub
parent
594db7fb43
commit
94f60e199b
@ -85,12 +85,30 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||
org.Description = form.Description
|
||||
org.Website = form.Website
|
||||
org.Location = form.Location
|
||||
org.Visibility = form.Visibility
|
||||
org.RepoAdminChangeTeamAccess = form.RepoAdminChangeTeamAccess
|
||||
|
||||
visibilityChanged := form.Visibility != org.Visibility
|
||||
org.Visibility = form.Visibility
|
||||
|
||||
if err := models.UpdateUser(org); err != nil {
|
||||
ctx.ServerError("UpdateUser", err)
|
||||
return
|
||||
}
|
||||
|
||||
// update forks visibility
|
||||
if visibilityChanged {
|
||||
if err := org.GetRepositories(models.ListOptions{Page: 1, PageSize: org.NumRepos}); err != nil {
|
||||
ctx.ServerError("GetRepositories", err)
|
||||
return
|
||||
}
|
||||
for _, repo := range org.Repos {
|
||||
if err := models.UpdateRepository(repo, true); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Trace("Organization setting updated: %s", org.Name)
|
||||
ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success"))
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||
|
Reference in New Issue
Block a user