diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2020-01-11 08:29:34 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2020-01-11 02:29:34 -0500 |
commit | 32fb813133c74ddc3af1964e81fff72fea4f24f1 (patch) | |
tree | 31eec446f12e448d7cf398db43620606e9704ff1 /templates | |
parent | 4d06d10dbafe7cfd404889b636d8e243058ee96f (diff) | |
download | gitea-32fb813133c74ddc3af1964e81fff72fea4f24f1.tar.gz gitea-32fb813133c74ddc3af1964e81fff72fea4f24f1.zip |
Allow repo admin to merge PR regardless of review status (#9611)
* Allow repo admin to merge even if review is not ok.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 81 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 4 |
2 files changed, 54 insertions, 31 deletions
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 9dedc7dad7..7073312b1f 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -101,35 +101,31 @@ <span class="octicon octicon-x"></span> {{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" .WorkInProgressPrefix | Str2html}} </div> - {{else if .IsBlockedByApprovals}} - <div class="item text red"> - <span class="octicon octicon-x"></span> - {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}} - </div> - {{else if .IsBlockedByRejection}} - <div class="item text red"> - <span class="octicon octicon-x"></span> - {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} - </div> {{else if .Issue.PullRequest.IsChecking}} <div class="item text yellow"> <span class="octicon octicon-sync"></span> {{$.i18n.Tr "repo.pulls.is_checking"}} </div> - {{else if and (not .Issue.PullRequest.CanAutoMerge) .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}} - <div class="item text red"> - <span class="octicon octicon-x"></span> - {{$.i18n.Tr "repo.pulls.required_status_check_failed"}} - </div> {{else if .Issue.PullRequest.CanAutoMerge}} - {{if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}} - <div class="item text red"> - <span class="octicon octicon-x"></span> - {{$.i18n.Tr "repo.pulls.required_status_check_failed"}} - </div> + {{if .IsBlockedByApprovals}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}} + </div> + {{else if .IsBlockedByRejection}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} + </div> + {{else if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.required_status_check_failed"}} + </div> {{end}} - {{if or $.IsRepoAdmin (not .EnableStatusCheck) .IsRequiredStatusCheckSuccess}} - {{if and $.IsRepoAdmin .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}} + {{$notAllOk := or .IsBlockedByApprovals .IsBlockedByRejection (and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess))}} + {{if or $.IsRepoAdmin (not $notAllOk)}} + {{if $notAllOk}} <div class="item text yellow"> <span class="octicon octicon-primitive-dot"></span> {{$.i18n.Tr "repo.pulls.required_status_check_administrator"}} @@ -216,7 +212,7 @@ </form> </div> {{end}} - <div class="ui green buttons merge-button"> + <div class="ui {{if $notAllOk}}red{{else}}green{{end}} buttons merge-button"> <button class="ui button" data-do="{{.MergeStyle}}"> <span class="octicon octicon-git-merge"></span> <span class="button-text"> @@ -262,17 +258,40 @@ {{$.i18n.Tr "repo.pulls.no_merge_helper"}} </div> {{end}} + {{else}} + <div class="item text grey"> + <span class="octicon octicon-info"></span> + {{$.i18n.Tr "repo.pulls.no_merge_access"}} + </div> {{end}} {{end}} {{else}} - <div class="item text red"> - <span class="octicon octicon-x"></span> - {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}} - </div> - <div class="item text grey"> - <span class="octicon octicon-info"></span> - {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}} - </div> + {{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} + {{if .IsBlockedByApprovals}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}} + </div> + {{else if .IsBlockedByRejection}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} + </div> + {{else if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.required_status_check_failed"}} + </div> + {{else}} + <div class="item text red"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}} + </div> + <div class="item text grey"> + <span class="octicon octicon-info"></span> + {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}} + </div> + {{end}} {{end}} </div> </div> diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d0e23a460e..ddf144066d 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -10745,6 +10745,10 @@ }, "MergeTitleField": { "type": "string" + }, + "force_merge": { + "type": "boolean", + "x-go-name": "ForceMerge" } }, "x-go-name": "MergePullRequestForm", |