Unable to edit MR with unchecked mergeability state
Summary
Unable to edit MR's target branch when mergeability state is unchecked
Steps to reproduce
- Choose an old MR which status is likely to be unchecked
- Go straight to its edit page (the mergeability check is triggered when
show
page of an MR is visited) - Change the target branch
- Click save
Possible fixes
When merge status is unchecked and mark_as_unchecked
is called, then the status isn't changed, because we don't allow transitions from unchecked
to unchecked
: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/merge_request.rb#L199
Or do not trigger the marking on update if the status is unchecked: https://gitlab.com/gitlab-org/gitlab/-/blob/dfb9d338a4f232a9dcb383f509ffe8ce8247b521/app/services/merge_requests/update_service.rb#L64