From abfeefec1a61f01a5fe3ba3be152c2c93309daea Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 7 May 2022 19:09:30 +0200 Subject: [PATCH 01/18] Revert "remove webUI part for another pull" This reverts commit 9f43fc9d9aa8ee99b2ad1a86e76423796ffda198. --- templates/repo/issue/view_content/pull.tmpl | 406 ++++++++++++++++++-- web_src/js/features/repo-issue.js | 24 +- 2 files changed, 395 insertions(+), 35 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 8c43ace32e134..f2a3192e5bce3 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -321,8 +321,25 @@ {{if .AllowMerge}} {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} {{$approvers := .Issue.PullRequest.GetApprovers}} + {{/* We build a custom variable here to not clutter the template with checks if .LatestCommitStatus exists. */}} + {{$statusChecksPending := true}} + {{if .LatestCommitStatus}} + {{$statusChecksPending = not (eq .LatestCommitStatus.State "success")}} + {{end}} + {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}}
+ {{ $mergeButtonColor := "green"}} + {{if $statusChecksPending}} + {{ $mergeButtonColor = "blue"}} + {{end}} + {{ if .HasPendingPullRequestMerge }} + {{ $mergeButtonColor = "red"}} + {{ $createdPRMergeStr:= TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n.Lang }} +
+ {{$.i18n.Tr "repo.pulls.pr_has_pending_merge_on_success" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr | Safe }} +
+ {{end}} {{if $prUnit.PullRequestsConfig.AllowMerge}} + {{end}} -
-
- + + {{if .IsPullBranchDeletable}} +
+ + +
+ {{end}} + +
+ + {{end}} + {{if $prUnit.PullRequestsConfig.AllowRebaseMerge}} + + + {{end}} + {{if $prUnit.PullRequestsConfig.AllowSquash}} + + + {{end}} + + {{if and $statusChecksPending (not .HasPendingPullRequestMerge)}} +
+ - {{if gt $prUnit.PullRequestsConfig.AllowedMergeStyleCount 1}} - +
+ + +
+ {{else if .HasPendingPullRequestMerge}} +
+
+ + - {{end}} +
+
+ {{.CsrfTokenHtml}} + +
-
+ {{else}} + {{if and $prUnit.PullRequestsConfig.AllowManualMerge $.IsRepoAdmin}} + + {{end}} +
+
+ + {{if gt $prUnit.PullRequestsConfig.AllowedMergeStyleCount 1}} + + {{end}} +
+
+ {{end}} {{if .ShowMergeInstructions}}
{{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}}
{{end}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index c764138fa0474..68a7fdc85d4d8 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -323,8 +323,18 @@ {{$approvers := .Issue.PullRequest.GetApprovers}} {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} -
+ {{$latestCommitStatusState := ""}} + {{if .LatestCommitStatus}} + {{/* "success" or others */}} + {{$latestCommitStatusState = .LatestCommitStatus.State}} + {{end}} + {{$hasPendingPullRequestMergeTip := ""}} + {{if .HasPendingPullRequestMerge}} + {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n.Lang}} + {{$hasPendingPullRequestMergeTip = $.i18n.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} + {{end}} +
From 935ab7b9d50316504a378866750268384d901d97 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 20 May 2022 00:18:10 +0800 Subject: [PATCH 08/18] fine tune button colors --- .../js/components/PullRequestMergeForm.vue | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 5b5889f9b5019..0548ddb2a5e67 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -22,7 +22,7 @@
-