aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2021-10-17 18:58:36 +0200
committerGitHub <noreply@github.com>2021-10-17 17:58:36 +0100
commit26dfe88ff2431234c0b9cc172c6b62562a03aab8 (patch)
tree19b4fc73eeb84bb38256af27b02a923eab22989d /routers
parent554988c7b23aef99c226986509ab55ce74af7671 (diff)
downloadgitea-26dfe88ff2431234c0b9cc172c6b62562a03aab8.tar.gz
gitea-26dfe88ff2431234c0b9cc172c6b62562a03aab8.zip
Hide command line merge instructions when user can't push (#17339)
Hides the command line instructions if the authenticated user can't push to the base branch. Closes #17121
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/issue.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 1aaa27c2b0..173cb49e45 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -1543,6 +1543,7 @@ func ViewIssue(ctx *context.Context) {
ctx.ServerError("LoadProtectedBranch", err)
return
}
+ ctx.Data["ShowMergeInstructions"] = true
if pull.ProtectedBranch != nil {
cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull)
ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(pull)
@@ -1554,6 +1555,7 @@ func ViewIssue(ctx *context.Context) {
ctx.Data["ChangedProtectedFiles"] = pull.ChangedProtectedFiles
ctx.Data["IsBlockedByChangedProtectedFiles"] = len(pull.ChangedProtectedFiles) != 0
ctx.Data["ChangedProtectedFilesNum"] = len(pull.ChangedProtectedFiles)
+ ctx.Data["ShowMergeInstructions"] = pull.ProtectedBranch.CanUserPush(ctx.User.ID)
}
ctx.Data["WillSign"] = false
if ctx.User != nil {