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:
parent
b6d77229cf
commit
49919c636e
11 changed files with 72 additions and 34 deletions
|
@ -863,6 +863,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
AllowRebaseUpdate: true,
|
||||
DefaultDeleteBranchAfterMerge: false,
|
||||
DefaultMergeStyle: repo_model.MergeStyleMerge,
|
||||
DefaultAllowMaintainerEdit: false,
|
||||
}
|
||||
} else {
|
||||
config = unit.PullRequestsConfig()
|
||||
|
@ -898,6 +899,9 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
if opts.DefaultMergeStyle != nil {
|
||||
config.DefaultMergeStyle = repo_model.MergeStyle(*opts.DefaultMergeStyle)
|
||||
}
|
||||
if opts.DefaultAllowMaintainerEdit != nil {
|
||||
config.DefaultAllowMaintainerEdit = *opts.DefaultAllowMaintainerEdit
|
||||
}
|
||||
|
||||
units = append(units, repo_model.RepoUnit{
|
||||
RepoID: repo.ID,
|
||||
|
|
|
@ -820,6 +820,13 @@ func CompareDiff(ctx *context.Context) {
|
|||
|
||||
ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypePullRequests)
|
||||
|
||||
if unit, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypePullRequests); err == nil {
|
||||
config := unit.PullRequestsConfig()
|
||||
ctx.Data["AllowMaintainerEdit"] = config.DefaultAllowMaintainerEdit
|
||||
} else {
|
||||
ctx.Data["AllowMaintainerEdit"] = false
|
||||
}
|
||||
|
||||
ctx.HTML(http.StatusOK, tplCompare)
|
||||
}
|
||||
|
||||
|
|
|
@ -529,6 +529,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
AllowRebaseUpdate: form.PullsAllowRebaseUpdate,
|
||||
DefaultDeleteBranchAfterMerge: form.DefaultDeleteBranchAfterMerge,
|
||||
DefaultMergeStyle: repo_model.MergeStyle(form.PullsDefaultMergeStyle),
|
||||
DefaultAllowMaintainerEdit: form.DefaultAllowMaintainerEdit,
|
||||
},
|
||||
})
|
||||
} else if !unit_model.TypePullRequests.UnitGlobalDisabled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue