[PORT] Add warning message in merge instructions when AutodetectManualMerge was not enabled (gitea#31805)

---

Conflict resolution: trivial
Things done differently: Improve localization message, use the paragraph
element instead of the div element, fix passing this variable to the
template and add a integration test

(cherry picked from commit 9633f336c87947dc7d2a5e76077a10699ba5e50d)
This commit is contained in:
a1012112796 2024-08-10 09:09:34 +08:00 committed by Gusted
parent 44002a6399
commit e5f8d144f2
No known key found for this signature in database
GPG key ID: FD821B732837125F
5 changed files with 53 additions and 2 deletions

View file

@ -388,7 +388,7 @@
{{end}}
{{if and .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}}
{{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions}}
{{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions "AutodetectManualMerge" .AutodetectManualMerge}}
{{end}}
</div>
</div>

View file

@ -15,7 +15,13 @@
<div>git checkout {{$localBranch}}</div>
</div>
{{if .ShowMergeInstructions}}
<div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}</div>
<div id="merge-instructions">
<h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
{{if not .AutodetectManualMerge}}
<p>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</p>
{{end}}
</div>
<div class="ui secondary segment">
<div data-pull-merge-style="merge">
<div>git checkout {{.PullRequest.BaseBranch}}</div>