diff options
author | a1012112796 <1012112796@qq.com> | 2020-11-29 03:30:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 21:30:46 +0200 |
commit | 9c26dc1f3a742280baff4e9578545bc822016764 (patch) | |
tree | ac997d23e59a658b387302ecd65e76a39d99b9e8 /templates | |
parent | 7ed5bf8cbe06bf2cfc4980cf6e020dc46dd71a79 (diff) | |
download | gitea-9c26dc1f3a742280baff4e9578545bc822016764.tar.gz gitea-9c26dc1f3a742280baff4e9578545bc822016764.zip |
Add block on official review requests branch protection (#13705)
Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 15 | ||||
-rw-r--r-- | templates/repo/settings/protected_branch.tmpl | 7 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 12 |
3 files changed, 32 insertions, 2 deletions
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index dbecf644d9..9d8ea7ba8a 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -84,6 +84,7 @@ {{- else if .IsPullRequestBroken}}red {{- else if .IsBlockedByApprovals}}red {{- else if .IsBlockedByRejection}}red + {{- else if .IsBlockedByOfficialReviewRequests}}red {{- else if .IsBlockedByOutdatedBranch}}red {{- else if .IsBlockedByChangedProtectedFiles}}red {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red @@ -159,6 +160,11 @@ <i class="icon icon-octicon">{{svg "octicon-x"}}</i> {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} </div> + {{else if .IsBlockedByOfficialReviewRequests}} + <div class="item"> + <i class="icon icon-octicon">{{svg "octicon-x"}}</i> + {{$.i18n.Tr "repo.pulls.blocked_by_official_review_requests"}} + </div> {{else if .IsBlockedByOutdatedBranch}} <div class="item"> <i class="icon icon-octicon">{{svg "octicon-x"}}</i> @@ -194,7 +200,7 @@ {{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }} </div> {{end}} - {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} + {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} {{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} {{if $notAllOverridableChecksOk}} <div class="item"> @@ -384,7 +390,12 @@ {{else if .IsBlockedByRejection}} <div class="item text red"> {{svg "octicon-x"}} - {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} + {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}} + </div> + {{else if .IsBlockedByOfficialReviewRequests}} + <div class="item text red"> + {{svg "octicon-x"}} + {{$.i18n.Tr "repo.pulls.blocked_by_official_review_requests"}} </div> {{else if .IsBlockedByOutdatedBranch}} <div class="item text red"> diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 53a978e068..1fbd28d8bd 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -213,6 +213,13 @@ </div> <div class="field"> <div class="ui checkbox"> + <input name="block_on_official_review_requests" type="checkbox" {{if .Branch.BlockOnOfficialReviewRequests}}checked{{end}}> + <label for="block_on_official_review_requests">{{.i18n.Tr "repo.settings.block_on_official_review_requests"}}</label> + <p class="help">{{.i18n.Tr "repo.settings.block_on_official_review_requests_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> <input name="dismiss_stale_approvals" type="checkbox" {{if .Branch.DismissStaleApprovals}}checked{{end}}> <label for="dismiss_stale_approvals">{{.i18n.Tr "repo.settings.dismiss_stale_approvals"}}</label> <p class="help">{{.i18n.Tr "repo.settings.dismiss_stale_approvals_desc"}}</p> diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 8bcfc43d73..b121451ba6 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -11326,6 +11326,10 @@ }, "x-go-name": "ApprovalsWhitelistUsernames" }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, "block_on_outdated_branch": { "type": "boolean", "x-go-name": "BlockOnOutdatedBranch" @@ -11660,6 +11664,10 @@ }, "x-go-name": "ApprovalsWhitelistUsernames" }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, "block_on_outdated_branch": { "type": "boolean", "x-go-name": "BlockOnOutdatedBranch" @@ -12605,6 +12613,10 @@ }, "x-go-name": "ApprovalsWhitelistUsernames" }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, "block_on_outdated_branch": { "type": "boolean", "x-go-name": "BlockOnOutdatedBranch" |