Skip to content

Move "Add Approver" Name Validation Error into Form

What does this MR do?

For #32306 (closed)

When the user tries to add an approval rule with a name that's already been used, that error is shown in the modal as an error under the name input field.

Technical

This MR removes the .catch handlers in the actions that directly trigger a createFlash.

The triggering component handles the .catch and sets a local value that is used to show the error in the modal.

Extra Notes

When settings.allowMultiRule is false, the name input is completely hidden, so it's not possible (assuming correct behavior otherwise) for the user to have input a duplicate name. Because of this, neither of the actions in the guarded clause in submitRule are tested.

Additionally: when adding a "duplicate" rule name on the MR Edit page, there's no duplicate constraint returned by the backend (which raises the question of whether this is a valid constraint at all). A user can add many rules with the same name on the MR edit page, so this error UX never triggers, and I haven't added any screenshots for the (unchanged) UI there. Because of this, the mr-edit prefix isn't tested.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Thomas Randolph

Merge request reports