Problem/Motivation

Updating an alert that is dismissible and has been dismissed to no longer be dismissible does not re-show the previously dismissed alert. An alert that is not able to be dismissed should probably show even if it was previously dismissible and dismissed.

Steps to reproduce

  • Create a dismissible alert
  • Dismiss the alert
  • Update the alert, unchecking dismissible
  • Check the front end, the alert is still dismissed

Proposed resolution

There's two ways to fix this, either change the js so it ensures an alert is dismissible before checking if it has been dismissed or trigger setDismissibleIgnoreBeforeTime on save when the dismissible checkbox is unticked. The only difference is very niche. If the js solution is used, the steps above are followed, then the alert is once more set to dismissible it will be dismissed.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wolffereast created an issue. See original summary.

wolffereast’s picture

Title: Marking a dismissed alert not dismissable does not show the alert » Marking a dismissed alert not dismissible does not show the alert
Issue summary: View changes

wolffereast’s picture

Version: 3.1.1 » 3.1.x-dev
Status: Active » Needs review

I put together an MR that has the js version of the update. I'm happy to swap for the setDismissibleIgnoreBeforeTime update on save if that is preferred.

chrissnyder made their first commit to this issue’s fork.

chrissnyder’s picture

Thank you for this work. I have moved your work to the appropriate "issue branch"

chrissnyder changed the visibility of the branch 3.1.x to hidden.

chrissnyder’s picture

I have moved the logic to the alertWasDismissed function and addes some tests.

@wolffereast Can you review the work in https://git.drupalcode.org/project/sitewide_alert/-/merge_requests/109/d... to make sure it still solves your issue?

wolffereast’s picture

Shoot, apologies for putting the MR in the wrong place. I can confirm that the update still fixes my issue. I didn't run the new tests, if the functional review is enough for RTBC then go for it.

chrissnyder’s picture

Status: Needs review » Reviewed & tested by the community
chrissnyder’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • chrissnyder committed 04a642ed on 3.1.x
    fix: #3587695 Marking a dismissed alert not dismissible does not show...
chrissnyder’s picture

Fixed in 3.1.2

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.