From 94f60e199bc504c6cfb7b853889e3ceb2a837adc Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Sun, 7 Jun 2020 02:45:12 +0200 Subject: 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 Co-authored-by: zeripath Co-authored-by: techknowlogick --- modules/repository/fork.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/repository') diff --git a/modules/repository/fork.go b/modules/repository/fork.go index 2ed2a0eb78..169c391edd 100644 --- a/modules/repository/fork.go +++ b/modules/repository/fork.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/structs" ) // ForkRepository forks a repository @@ -36,7 +37,7 @@ func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, LowerName: strings.ToLower(name), Description: desc, DefaultBranch: oldRepo.DefaultBranch, - IsPrivate: oldRepo.IsPrivate, + IsPrivate: oldRepo.IsPrivate || oldRepo.Owner.Visibility == structs.VisibleTypePrivate, IsEmpty: oldRepo.IsEmpty, IsFork: true, ForkID: oldRepo.ID, -- cgit v1.2.3