summaryrefslogtreecommitdiffstats
path: root/modules/repository/fork.go
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-06-07 02:45:12 +0200
committerGitHub <noreply@github.com>2020-06-06 20:45:12 -0400
commit94f60e199bc504c6cfb7b853889e3ceb2a837adc (patch)
tree4bfcb10071d6b8356863f11370d91b91b19894bc /modules/repository/fork.go
parent594db7fb433a386603c09676542bb0ec2e700935 (diff)
downloadgitea-94f60e199bc504c6cfb7b853889e3ceb2a837adc.tar.gz
gitea-94f60e199bc504c6cfb7b853889e3ceb2a837adc.zip
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>
Diffstat (limited to 'modules/repository/fork.go')
-rw-r--r--modules/repository/fork.go3
1 files changed, 2 insertions, 1 deletions
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,