Show alerts again after dismiss (after a specified time)

Created on 15 November 2021, over 3 years ago
Updated 4 November 2024, 8 months ago

Actually dismissed messages never shown again.
In my use case we need to display again dismissed messages after a specified time. (In my case after 24 hours)
So this would be a nice feature:
On sitewide_alert create/edit form in case I check "dismissable" checkbox display a "Dismiss period" field or something similar. (Or replace the Dismissable checkbox with a 3-way radio button: "Persistent", "Dismissable", "Snoozable" and display "Dismiss period" or "Snooze period" in case I chosed "Snoozable" )
In case i fill Dismiss/snooze period (e.g 24h) then the dismissed alert will be shown again after the specified time has passed.
Yo you need to store in the local storage the dismiss perion and modify the JS to check this value too.

โœจ Feature request
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ญ๐Ÿ‡บHungary kepesv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    I also like this idea! Lets target the 3.0.x first

  • ๐Ÿ‡ช๐Ÿ‡จEcuador alexis_mc

    Initial implementation to support time-based dismissible alerts.

    Summary of changes:

    New field: dismiss_period (integer, in hours), shown when โ€œDismissibleโ€ is enabled.

    Backend:

    Field added in baseFieldDefinitions()

    Update hook (sitewide_alert_update_10301()) installs the field

    Included in the form with conditional visibility

    Frontend:

    JavaScript updated to handle dismissal expiration via localStorage

    Behavior:

    Empty dismiss_period โ†’ permanent dismissal (default)

    Value set โ†’ alert reappears after specified hours (e.g., 1, 24, 168)

    Testing:

    Set dismiss_period, dismiss alert, and verify it reappears after time

    Backward compatible with existing alerts

  • First commit to issue fork.
  • ๐Ÿ‡จ๐Ÿ‡ดColombia pablomoto1000

    Thanks to @alexis_mc for the contribution, one change was made in order to allow 0 hours value in the dismiss to allow a permanent solution.

Production build 0.71.5 2024