Skip to content

Add the ability to close a flash message in code

Thomas Randolph requested to merge tor/feature/closeable-flash into master

What does this MR do?

For #292008 (closed) - broadly.

This MR adds a .close method to the Flash container returned by createFlash (and - by extension - the one returned by deprecatedCreateFlash).

The close method has a closure around its own DOM, so when it is called, it simply... clicks the close icon.
The normal behavior attached to the close icon takes over from there.

That's it, that's the whole thing.

But Vue!

Yes! We have a Vue Alert component in the gitlab-ui project.

Sometimes, however, adding one small QoL function to existing tooling is just a smidge more efficient than refactoring a UI to use different components.
In this case, especially, we don't need to modify the notification (yet)! So getting UX involved is inefficient. We can just add a method that clicks the close icon and we're off to the races!

Where are we?

MR Description
!60536 (merged) Add a small utility that adds a stateful memory bank for tracking repeated occurrences of [thing]. This is a small, generic utility that's not specific to error handling, it just remembers how many times you tell it something happened, and it will perform your requested behaviors for certain counts.
We're here 👉🏻 Make Flash messages programmatically dismissable
!60533 (merged) When the Notes app is polling for new notes and that request fails, wait to display the error until we're sure the failure isn't transient (it happens twice in a row)

Screenshots (strongly suggested)

N/A, all "refactoring" and adding a code feature.

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