Problem/Motivation

Some messages, such as the ones being discussed in #3041885: Display relevant Security Advisories data for Drupal, are important for users to see. But then after they've seen them, there's nothing they can do about it until later. It would be great to allow the user the option to dismiss them.

(Looks like there are numerous attempts found in contrib, but I couldn't find a core issue, so here is one. :)

Proposed resolution

Probably several ways to go about this, but one stab is:

  • Add a dismissable flag to the Message API.
  • If true, pull in some JS code for dismissing the message

Remaining tasks

1. Talk about it
2. Research best implementation approach
3. Get 'er done!

User interface changes

Yes.

API changes

Yes.

Data model changes

Yes.

Release notes snippet

Comments

webchick created an issue. See original summary.

aaronmchale’s picture

Yes I agree this is valuable.

One initial thought I have is, once the user triggers the "dismissal" of a given message, how do we track that between page loads and sessions? Do we need to generate a UUID for every message that the messaging service handles and track which ones have been "read" or "dismissed" (kind of like how the Track module works for allowing users to track new comments/updates on content)?

I presume we care about this, it could be pretty poor UX if the user dismisses a message, then when they navigate to another page the message is back.

If we do go down that road, to save on resources, do we introduce a technical difference between say:

  • Persistent Messages: ones that are meant to stay between pages and sessions and can be dismissed, these are given some identifier (like a UUID) and tracked in the session or database (e.g. the PSA messages), so that we can track whether the user dismissed a given message or not;
  • Non-persistent Messages: ones that are gone after the user navigates to a different page, and so don't need to be tracked, maybe though they still need to be dismissed (e.g. the "Entity X was created/updated" messages that we see all the time).

Heck, do we need a whole new "notifications UI" which is more catered to these persistent messages and facilitates the persistent dismissal of messages?

Version: 10.0.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.