diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/repo.go | 4 | ||||
-rw-r--r-- | routers/web/repo/compare.go | 7 | ||||
-rw-r--r-- | routers/web/repo/setting.go | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 1426d1dbcc..f5db45ffea 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -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, diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index c4b8c814e6..5b6faf4d83 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -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) } diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 5c30795f22..436438c436 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -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() { |