Skip to content

Commit ffd2269

Browse files
authored
Fix "Updating branch by merge" bug in "update_branch_by_merge.tmpl" (#23790)
Fix regression of #22683 , it didn't pass all variables into sub-template. Close #23787 After the fix, all links and the form are correct. ![image](https://user-images.githubusercontent.com/2114189/228511037-580b5f5d-43e7-494f-9b66-89f9f908e208.png) ![image](https://user-images.githubusercontent.com/2114189/228510958-f960284a-101d-4b0e-b887-80033127898d.png)
1 parent c09eab5 commit ffd2269

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

templates/repo/issue/view_content/pull.tmpl

+2-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
{{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
129129
<div class="content">
130130
{{template "repo/pulls/status" .}}
131-
{{$canAutoMerge := false}}
132131
{{$showGeneralMergeForm := false}}
133132
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
134133
{{if .Issue.PullRequest.HasMerged}}
@@ -193,7 +192,7 @@
193192
{{end}}
194193
</div>
195194
</div>
196-
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
195+
{{template "repo/issue/view_content/update_branch_by_merge" $}}
197196
{{else if .Issue.PullRequest.IsChecking}}
198197
<div class="item">
199198
<i class="icon icon-octicon">{{svg "octicon-sync"}}</i>
@@ -286,7 +285,7 @@
286285
</div>
287286
{{end}}
288287
{{end}}
289-
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
288+
{{template "repo/issue/view_content/update_branch_by_merge" $}}
290289
{{if .Issue.PullRequest.IsEmpty}}
291290
<div class="ui divider"></div>
292291

templates/repo/issue/view_content/update_branch_by_merge.tmpl

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
{{$canAutoMerge := false}}
2-
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
1+
{{if and (gt $.Issue.PullRequest.CommitsBehind 0) (not $.Issue.IsClosed) (not $.Issue.PullRequest.IsChecking) (not $.IsPullFilesConflicted) (not $.IsPullRequestBroken)}}
32
<div class="ui divider"></div>
43
<div class="item item-section">
54
<div class="item-section-left">
65
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
76
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
87
</div>
98
<div class="item-section-right">
10-
{{if and .UpdateAllowed .UpdateByRebaseAllowed}}
9+
{{if and $.UpdateAllowed $.UpdateByRebaseAllowed}}
1110
<div class="gt-dib">
1211
<div class="ui buttons update-button">
13-
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
12+
<button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}">
1413
<span class="button-text">
1514
{{$.locale.Tr "repo.pulls.update_branch"}}
1615
</span>
@@ -19,17 +18,17 @@
1918
<div class="ui dropdown icon button no-text">
2019
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
2120
<div class="menu">
22-
<a class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
23-
<a class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
21+
<a class="item active selected" data-do="{{$.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
22+
<a class="item" data-do="{{$.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
2423
</div>
2524
</div>
2625
</div>
2726
</div>
2827
{{end}}
29-
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
30-
<form action="{{.Link}}/update" method="post" class="ui update-branch-form">
31-
{{.CsrfTokenHtml}}
32-
<button class="ui compact button" data-do="update">
28+
{{if and $.UpdateAllowed (not $.UpdateByRebaseAllowed)}}
29+
<form action="{{$.Link}}/update" method="post" class="ui update-branch-form">
30+
{{$.CsrfTokenHtml}}
31+
<button class="ui compact button">
3332
<span class="ui text">{{$.locale.Tr "repo.pulls.update_branch"}}</span>
3433
</button>
3534
</form>

0 commit comments

Comments
 (0)