summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-03-01 01:47:30 +0100
committerGitHub <noreply@github.com>2021-03-01 01:47:30 +0100
commita4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8 (patch)
tree92edf61ff2447e067a676832844a129050b4ec0f /modules/context/repo.go
parente0900310c4354311362ef69d15c302c215eaa2a2 (diff)
downloadgitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.tar.gz
gitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.zip
Repository transfer has to be confirmed, if user can not create repo for new owner (#14792)
* make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination * if new pending transfer ocured, create UI & Mail notifications
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index bf149b8158..ba3cfe9bf2 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -600,6 +600,24 @@ func RepoAssignment() func(http.Handler) http.Handler {
ctx.Data["CanCompareOrPull"] = canCompare
ctx.Data["PullRequestCtx"] = ctx.Repo.PullRequest
+ if ctx.Repo.Repository.Status == models.RepositoryPendingTransfer {
+ repoTransfer, err := models.GetPendingRepositoryTransfer(ctx.Repo.Repository)
+ if err != nil {
+ ctx.ServerError("GetPendingRepositoryTransfer", err)
+ return
+ }
+
+ if err := repoTransfer.LoadAttributes(); err != nil {
+ ctx.ServerError("LoadRecipient", err)
+ return
+ }
+
+ ctx.Data["RepoTransfer"] = repoTransfer
+ if ctx.User != nil {
+ ctx.Data["CanUserAcceptTransfer"] = repoTransfer.CanUserAcceptTransfer(ctx.User)
+ }
+ }
+
if ctx.Query("go-get") == "1" {
ctx.Data["GoGetImport"] = ComposeGoGetImport(owner.Name, repo.Name)
prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", "branch", ctx.Repo.BranchName)