Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pull requests Manually Merged option to be used by non-admins #27780

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,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 ctx.Repo.CanWrite(unit.TypeCode) && prConfig.AllowManualMerge {
brechtvl marked this conversation as resolved.
Show resolved Hide resolved
return true
}

Expand Down
6 changes: 3 additions & 3 deletions templates/repo/issue/view_content/pull.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
},
{
'name': 'manually-merged',
'allowed': {{and $prUnit.PullRequestsConfig.AllowManualMerge $.IsRepoAdmin}},
'allowed': {{and $prUnit.PullRequestsConfig.AllowManualMerge}},
brechtvl marked this conversation as resolved.
Show resolved Hide resolved
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.merge_manually"}},
'hideMergeMessageTexts': true,
'hideAutoMerge': true,
Expand Down Expand Up @@ -349,13 +349,13 @@
{{end}}{{/* end if: pull request status */}}

{{/*
Manually Merged is not a well-known feature, it helps repo admins to mark a non-mergeable PR (already merged, conflicted) as merged
Manually Merged is not a well-known feature, it is used to mark a non-mergeable PR (already merged, conflicted) as merged
To test it:
* Enable "Manually Merged" feature in the Repository Settings
* Create a pull request, either:
* - Merge the pull request branch locally and push the merged commit to Gitea
* - Make some conflicts between the base branch and the pull request branch
* Then the Manually Merged form will be shown to repo admin users
* Then the Manually Merged form will be shown in the merge form
*/}}
{{if and $.StillCanManualMerge (not $showGeneralMergeForm)}}
<div class="divider"></div>
Expand Down