Finish review fails when "approve" box is checked on already-approved MR
Summary
The "Submit review" button will fail to submit a MR review when you check the "approve MR" box for an MR that you already approved.
Steps to reproduce
- Create MR in a project that requires at least one approval
- Add one or more comments to the review
- Approve the MR
- Click "Finish review"
- Check the "Approve merge request" box
Example Project
gitlab-org/govern/demos/sandbox/test-approval-bug!2
What is the current bug behavior?
Error appears: "An error occurred while approving, please try again."
What is the expected correct behavior?
Review is submitted. No errors. MR stays approved.
Relevant logs and/or screenshots
Note MR is already approved, which is probably why we get the error:
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
The request POST https://gitlab.com/gitlab-org/govern/demos/sandbox/test-approval-bug/-/merge_requests/2/drafts/publish
fails with:
500 Internal Server Error
{"message":"An error occurred while approving, please try again."}
This is arguably a backend bug. The HTTP status should be 200
with a message of "already approved".