gitea/routers
Jason Song 90982bffa5
Add force_merge to merge request and fix checking mergable (#23010) (#23032)
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.
2023-02-21 09:42:22 -06:00
..
api Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2023-02-21 09:42:22 -06:00
common Add support for HEAD requests in Maven registry (#21834) (#21929) 2022-11-25 13:46:28 +02:00
install Provide the ability to set password hash algorithm parameters (#22942) (#22943) 2023-02-19 15:35:52 +08:00
private Fix missing message in git hook when pull requests disabled on fork (#22625) (#22658) 2023-01-30 08:55:45 +08:00
utils refactor webhook *NewPost (#20729) 2022-08-11 17:48:23 +02:00
web Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2023-02-21 09:42:22 -06:00
init.go Sync git hooks when config file path changed (#21619) (#21626) 2022-10-30 11:17:11 +08:00