forgejo/services/forms
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
..
admin.go Add Visible modes function from Organisation to Users too (#16069) 2021-06-26 20:53:14 +01:00
auth_form.go Revert unrelated changes for SMTP auth (#21767) (#21768) 2022-11-10 16:11:56 -05:00
org.go Team permission allow different unit has different permission (#17811) 2022-01-05 11:37:00 +08:00
repo_branch_form.go Keep path when creating a new branch (#21153) 2022-09-15 21:25:16 +08:00
repo_form.go Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2023-02-21 09:42:22 -06:00
repo_form_test.go format with gofumpt (#18184) 2022-01-20 18:46:10 +01:00
repo_tag_form.go Add tag protection (#15629) 2021-06-25 16:28:55 +02:00
user_form.go Record OAuth client type at registration (#21316) 2022-10-24 15:59:24 +08:00
user_form_auth_openid.go Add support mCaptcha as captcha provider (#20458) 2022-08-10 15:20:10 +02:00
user_form_hidden_comments.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
user_form_test.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00