Pull Requests: setting to allow edits by maintainers by default, tweak UI (#22862)

Add setting to allow edits by maintainers by default, to avoid having to
often ask contributors to enable this.

This also reorganizes the pull request settings UI to improve clarity.
It was unclear which checkbox options were there to control available
merge styles and which merge styles they correspond to.

Now there is a "Merge Styles" label followed by the merge style options
with the same name as in other menus. The remaining checkboxes were
moved to the bottom, ordered rougly by typical order of operations.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Brecht Van Lommel 2023-02-13 07:09:52 +01:00 committed by GitHub
parent b6d77229cf
commit 49919c636e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 72 additions and 34 deletions

View file

@ -238,7 +238,7 @@
<div class="inline field">
<div class="ui checkbox">
<label class="tooltip" data-content="{{.locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"><strong>{{.locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label>
<input name="allow_maintainer_edit" type="checkbox">
<input name="allow_maintainer_edit" type="checkbox" {{if .AllowMaintainerEdit}}checked{{end}}>
</div>
</div>
{{end}}

View file

@ -478,59 +478,41 @@
</div>
<div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box">
<div class="field">
<div class="ui checkbox">
<input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
</div>
<p>
{{.locale.Tr "repo.settings.merge_style_desc"}}
</p>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_merge_commits"}}</label>
<label>{{.locale.Tr "repo.pulls.merge_pull_request"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_rebase_merge"}}</label>
<label>{{.locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_rebase_merge_commit"}}</label>
<label>{{.locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_squash_commits"}}</label>
<label>{{.locale.Tr "repo.pulls.squash_merge_pull_request"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_manual_merge"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
<label>{{.locale.Tr "repo.pulls.merge_manually"}}</label>
</div>
</div>
<div class="field">
<p>
{{.locale.Tr "repo.settings.default_merge_style_desc"}}
@ -564,6 +546,36 @@
</div>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
</div>
</div>
</div>
{{end}}

View file

@ -16497,6 +16497,11 @@
"type": "boolean",
"x-go-name": "AutodetectManualMerge"
},
"default_allow_maintainer_edit": {
"description": "set to `true` to allow edits from maintainers by default",
"type": "boolean",
"x-go-name": "DefaultAllowMaintainerEdit"
},
"default_branch": {
"description": "sets the default branch for this repository.",
"type": "string",
@ -19015,6 +19020,10 @@
"format": "date-time",
"x-go-name": "Created"
},
"default_allow_maintainer_edit": {
"type": "boolean",
"x-go-name": "DefaultAllowMaintainerEdit"
},
"default_branch": {
"type": "string",
"x-go-name": "DefaultBranch"