From 4304273582b23fb30d00369403382862d2609062 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 31 Jan 2023 09:01:44 +0000 Subject: [PATCH 1/3] updating the template for updating the WIP from branch --- templates/repo/issue/view_content/pull.tmpl | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 1f94001db06eb..d629ce362b81c 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -190,6 +190,45 @@ {{end}} + // WIP update from branch 21740 - templ? + {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} +
+
+
+ {{svg "octicon-alert"}} + {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} +
+
+ {{if and .UpdateAllowed .UpdateByRebaseAllowed}} +
+
+ + + +
+
+ {{end}} + {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
+
+ {{end}} {{else if .Issue.PullRequest.IsChecking}}
{{svg "octicon-sync"}} From 16c0101f798aa544e2afc1482dd8f949f9b7ae91 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 31 Jan 2023 09:40:41 +0000 Subject: [PATCH 2/3] moved the update logic into a sub-template --- templates/repo/issue/view_content/pull.tmpl | 79 +------------------ .../view_content/update_branch_by_merge.tmpl | 39 +++++++++ 2 files changed, 41 insertions(+), 77 deletions(-) create mode 100644 templates/repo/issue/view_content/update_branch_by_merge.tmpl diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index d629ce362b81c..dc671eb6d6706 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -190,45 +190,7 @@ {{end}}
- // WIP update from branch 21740 - templ? - {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} -
-
-
- {{svg "octicon-alert"}} - {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} -
-
- {{if and .UpdateAllowed .UpdateByRebaseAllowed}} -
-
- - - -
-
- {{end}} - {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} -
- {{.CsrfTokenHtml}} - -
- {{end}} -
-
- {{end}} + {{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}} {{else if .Issue.PullRequest.IsChecking}}
{{svg "octicon-sync"}} @@ -321,44 +283,7 @@
{{end}} {{end}} - {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} -
-
-
- {{svg "octicon-alert"}} - {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} -
-
- {{if and .UpdateAllowed .UpdateByRebaseAllowed}} -
-
- - - -
-
- {{end}} - {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} -
- {{.CsrfTokenHtml}} - -
- {{end}} -
-
- {{end}} + {{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}} {{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 new file mode 100644 index 0000000000000..0b6f7ac033904 --- /dev/null +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -0,0 +1,39 @@ +{{$canAutoMerge := false}} +{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} +
+
+
+ {{svg "octicon-alert"}} + {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} +
+
+ {{if and .UpdateAllowed .UpdateByRebaseAllowed}} +
+
+ + + +
+
+ {{end}} + {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
+
+{{end}} From a4c28a49a3d36f4b01b3a3f904f3a48327c62e77 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 31 Jan 2023 22:13:24 +0000 Subject: [PATCH 3/3] fix indentation Signed-off-by: Andrew Thornton --- .../view_content/update_branch_by_merge.tmpl | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) 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 0b6f7ac033904..3bc8dcca9752e 100644 --- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -1,39 +1,39 @@ {{$canAutoMerge := false}} {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} -
-
-
- {{svg "octicon-alert"}} - {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} -
-
- {{if and .UpdateAllowed .UpdateByRebaseAllowed}} -
-
- +
+
+
+ {{svg "octicon-alert"}} + {{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} +
+
+ {{if and .UpdateAllowed .UpdateByRebaseAllowed}} +
+
+ - -
- {{end}} - {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} -
- {{.CsrfTokenHtml}} - -
- {{end}} + {{end}} + {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
-
{{end}}