From ffd22697baa8c1e28c6acb8a424359b9c5c5a58e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 31 Mar 2023 01:00:49 +0800 Subject: [PATCH] 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) --- 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 4d5d6ee49..8b758b2ac 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 49e4467dc..84df244d8 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}} -