summaryrefslogtreecommitdiffstats
path: root/modules/context
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-10-15 18:06:07 +0300
committerGitHub <noreply@github.com>2017-10-15 18:06:07 +0300
commit1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e (patch)
tree742d82bceac48af7f5088be3c70bdb6d000728ea /modules/context
parent32ca299650277829b93994eca1508f9d84a5b667 (diff)
downloadgitea-1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e.tar.gz
gitea-1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e.zip
Fix so that user can still fork his own repository to owned organizations (#2699)
* Fix so that user can still fork his own repository to his organizations * Fix to only use owned organizations * Add integration test for forking own repository to owned organization
Diffstat (limited to 'modules/context')
-rw-r--r--modules/context/repo.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 788588f8e4..88208922c8 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -337,6 +337,11 @@ func RepoAssignment() macaron.Handler {
ctx.Data["IsRepositoryAdmin"] = ctx.Repo.IsAdmin()
ctx.Data["IsRepositoryWriter"] = ctx.Repo.IsWriter()
+ if ctx.Data["CanSignedUserFork"], err = ctx.Repo.Repository.CanUserFork(ctx.User); err != nil {
+ ctx.Handle(500, "CanUserFork", err)
+ return
+ }
+
ctx.Data["DisableSSH"] = setting.SSH.Disabled
ctx.Data["ExposeAnonSSH"] = setting.SSH.ExposeAnonymous
ctx.Data["DisableHTTP"] = setting.Repository.DisableHTTPGit