Backport #23010.
Fix#23000.
The bug was introduced in #22633, and it seems that it has been noticed:
https://github.com/go-gitea/gitea/pull/22633#discussion_r1095395359 .
However, #22633 did nothing wrong, the logic should be "check if they is
admin only when `force` is true".
So we should provide the `ForceMerge` when merging from UI.
After this, an admin can also send a normal merge request with
`ForceMerge` false. So it fixes a potential bug: if the admin doesn't
want to do a force merge, they just see the green "Merge" button and
click it. At the same time, the status of the PR changed, and it
shouldn't be merged now, so the admin could send an unexpected force
merge.
In addition, I updated `ForceMerge *bool` to `ForceMerge bool`, I don't
see the reason to use a pointer.
And fixed the logic of CheckPullMergable to handle auto merge and force
merge correctly.
Backport #22999
This is rather private information that should not be given to all
members in the same organization. Only show it to organization owners.
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2 years ago
38 changed files with 217 additions and 79 deletions
ctx.Error(http.StatusMethodNotAllowed,"Invalid merge style",fmt.Errorf("%s is not allowed an allowed merge style for this repository",repo_model.MergeStyle(form.Do)))