From a1460333dc064c99efc71f4969b3061fcb107797 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 31 Mar 2023 12:15:51 +0800 Subject: [PATCH] Fix "Updating branch by merge" bug in "update_branch_by_merge.tmpl" (#23790) (#23825) Backport #23790 Fix regression of #22683 Pass all variables into sub-template. Close #23787 --- templates/repo/issue/view_content/pull.tmpl | 5 ++--- .../view_content/update_branch_by_merge.tmpl | 19 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index f0bf23c9e9..81f9041f2a 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -128,7 +128,6 @@ {{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}
{{template "repo/pulls/status" .}} - {{$canAutoMerge := false}} {{$showGeneralMergeForm := false}}
{{if .Issue.PullRequest.HasMerged}} @@ -193,7 +192,7 @@ {{end}}
- {{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}} + {{template "repo/issue/view_content/update_branch_by_merge" $}} {{else if .Issue.PullRequest.IsChecking}}
{{svg "octicon-sync"}} @@ -286,7 +285,7 @@
{{end}} {{end}} - {{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}} + {{template "repo/issue/view_content/update_branch_by_merge" $}} {{if .Issue.PullRequest.IsEmpty}}
diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl index 6d36a9b45f..84df244d8d 100644 --- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -1,5 +1,4 @@ -{{$canAutoMerge := false}} -{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} +{{if and (gt $.Issue.PullRequest.CommitsBehind 0) (not $.Issue.IsClosed) (not $.Issue.PullRequest.IsChecking) (not $.IsPullFilesConflicted) (not $.IsPullRequestBroken)}}
@@ -7,10 +6,10 @@ {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
- {{if and .UpdateAllowed .UpdateByRebaseAllowed}} + {{if and $.UpdateAllowed $.UpdateByRebaseAllowed}}
-
{{end}} - {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} -
- {{.CsrfTokenHtml}} -