Show feedback when required approvals are auto-saved

What does this MR do and why?

The "Approvals required" input on Project > Settings > Merge requests > Merge request approvals auto-saves about 1 second after you change it. It sends the request right away, separately from the "Save changes" button below it. The problem is that nothing tells you the save happened. The "Save changes" button stays disabled, so it looks like your change was lost. If the save request fails, nothing happens either, because the error is silently ignored.

This MR adds feedback for that auto-save. On success, it shows a "Required approvals updated." toast. On failure, it shows an alert and reports the error to Sentry. The same input is also used on the merge request create/edit form, but there the value is only saved when the merge request itself is saved, so no toast or alert shows there. That behavior is unchanged.

  • Show a toast when the approvals required value auto-saves successfully
  • Show an alert (and report to Sentry) if the auto-save fails
  • Skip the new feedback on the merge request create/edit form, using the existing isMrEdit prop
  • Add specs covering all three cases
  • Add the two new strings to locale/gitlab.pot

References

Screenshots or screen recordings

Before After
before_success.png after_success.png

after_error.png

How to set up and validate locally

  1. Check out the branch 630898-approvals-auto-save-feedback in GDK (approval rules need a Premium or Ultimate license).
  2. Go to a project, then Settings > Merge requests > Merge request approvals.
  3. Change the number in "Approvals required" for "Minimum required approvals" (or any rule) and wait about a second. A "Required approvals updated." toast should appear. Reload the page to confirm the value was kept.
  4. To see the error case, open the browser DevTools Network tab, block requests matching approval_rules, then change the value again. A red alert should appear.
  5. Open a new merge request with approval rules and change "Approvals required" there. No toast should appear, since the value only saves with the merge request.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #630898 (closed)

Edited by Sahil Bhatt

Merge request reports

Loading
Loading