aboutsummaryrefslogtreecommitdiffstats
path: root/templates
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 /templates
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 'templates')
-rw-r--r--templates/repo/issue/view_content/pull.tmpl38
1 files changed, 20 insertions, 18 deletions
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index aa0f3dc91a..706cc0eac7 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -485,25 +485,27 @@
{{end}}
</div>
</div>
- <div class="instruct-toggle ml-3"> {{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div>
- <div class="instruct-content" style="display:none">
- <div class="ui divider"></div>
- <div><h3 class="di">{{$.i18n.Tr "step1"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step1_desc"}}</div>
- <div class="ui secondary segment">
- {{if eq .Issue.PullRequest.Flow 0}}
- <div>git checkout -b {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}} {{.Issue.PullRequest.BaseBranch}}</div>
- <div>git pull {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.HTMLURL}}{{else}}origin{{end}} {{.Issue.PullRequest.HeadBranch}}</div>
- {{else}}
- <div>git fetch origin {{.Issue.PullRequest.GetGitRefName}}:{{.Issue.PullRequest.HeadBranch}}</div>
- {{end}}
- </div>
- <div><h3 class="di">{{$.i18n.Tr "step2"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step2_desc"}}</div>
- <div class="ui secondary segment">
- <div>git checkout {{.Issue.PullRequest.BaseBranch}}</div>
- <div>git merge --no-ff {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}}</div>
- <div>git push origin {{.Issue.PullRequest.BaseBranch}}</div>
+ {{if .ShowMergeInstructions}}
+ <div class="instruct-toggle ml-3"> {{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div>
+ <div class="instruct-content" style="display:none">
+ <div class="ui divider"></div>
+ <div><h3 class="di">{{$.i18n.Tr "step1"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step1_desc"}}</div>
+ <div class="ui secondary segment">
+ {{if eq .Issue.PullRequest.Flow 0}}
+ <div>git checkout -b {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}} {{.Issue.PullRequest.BaseBranch}}</div>
+ <div>git pull {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.HTMLURL}}{{else}}origin{{end}} {{.Issue.PullRequest.HeadBranch}}</div>
+ {{else}}
+ <div>git fetch origin {{.Issue.PullRequest.GetGitRefName}}:{{.Issue.PullRequest.HeadBranch}}</div>
+ {{end}}
+ </div>
+ <div><h3 class="di">{{$.i18n.Tr "step2"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step2_desc"}}</div>
+ <div class="ui secondary segment">
+ <div>git checkout {{.Issue.PullRequest.BaseBranch}}</div>
+ <div>git merge --no-ff {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}}</div>
+ <div>git push origin {{.Issue.PullRequest.BaseBranch}}</div>
+ </div>
</div>
- </div>
+ {{end}}
{{else}}
<div class="ui divider"></div>
<div class="item text red">