gitea/routers/api/v1
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
..
activitypub Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2022-10-24 20:29:17 +01:00
admin Provide the ability to set password hash algorithm parameters (#22942) (#22943) 2023-02-19 15:35:52 +08:00
misc Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2022-10-24 20:29:17 +01:00
notify Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
org [API] teamSearch show teams with no members if user is admin (#21204) 2022-09-19 20:02:29 +08:00
packages Add support for Vagrant packages (#20930) 2022-08-29 15:04:45 +08:00
repo Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2023-02-21 09:42:22 -06:00
settings Make mirror feature more configurable (#16957) 2021-09-07 17:49:36 +02:00
swagger Add API endpoint to get changed files of a PR (#21177) 2022-09-29 04:27:20 +02:00
user Record OAuth client type at registration (#21316) 2022-10-24 15:59:24 +08:00
utils Use complete SHA to create and query commit status (#22244) (#22257) 2022-12-28 11:03:21 +01:00
api.go Prevent panic on looking at api "git" endpoints for empty repos (#22457) (#22458) 2023-01-15 14:35:56 +00:00
auth.go Remove legacy `+build:` constraint (#19582) 2022-05-02 23:22:45 +08:00
auth_windows.go Let web and API routes have different auth methods group (#19168) 2022-03-28 12:46:28 +08:00