mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Allow pull requests Manually Merged option to be used by non-admins (#27780)
Currently this feature is only available to admins, but there is no clear reason why. If a user can actually merge pull requests, then this seems fine as well. This is useful in situations where direct pushes to the repository are commonly done by developers. --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
committed by
GitHub
parent
b36e2ca419
commit
1756e30e10
@@ -1773,7 +1773,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
pull := issue.PullRequest
|
||||
pull.Issue = issue
|
||||
canDelete := false
|
||||
ctx.Data["AllowMerge"] = false
|
||||
allowMerge := false
|
||||
|
||||
if ctx.IsSigned {
|
||||
if err := pull.LoadHeadRepo(ctx); err != nil {
|
||||
@@ -1806,7 +1806,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["AllowMerge"], err = pull_service.IsUserAllowedToMerge(ctx, pull, perm, ctx.Doer)
|
||||
allowMerge, err = pull_service.IsUserAllowedToMerge(ctx, pull, perm, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("IsUserAllowedToMerge", err)
|
||||
return
|
||||
@@ -1818,6 +1818,8 @@ func ViewIssue(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Data["AllowMerge"] = allowMerge
|
||||
|
||||
prUnit, err := repo.GetUnit(ctx, unit.TypePullRequests)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUnit", err)
|
||||
@@ -1927,7 +1929,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
if pull.CanAutoMerge() || pull.IsWorkInProgress(ctx) || pull.IsChecking() {
|
||||
return false
|
||||
}
|
||||
if (ctx.Doer.IsAdmin || ctx.Repo.IsAdmin()) && prConfig.AllowManualMerge {
|
||||
if allowMerge && prConfig.AllowManualMerge {
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user