From 1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Sun, 15 Oct 2017 18:06:07 +0300 Subject: 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 --- modules/context/repo.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules') 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 -- cgit v1.2.3