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.
Issue fork sitewide_alert-3587695
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:
- 3587695-show-undismissible-alert
changes, plain diff MR !109
- 3.1.x
changes, plain diff MR !105
Comments
Comment #2
wolffereast commentedComment #4
wolffereast commentedI 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.
Comment #7
chrissnyderThank you for this work. I have moved your work to the appropriate "issue branch"
Comment #9
chrissnyderI 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?
Comment #10
wolffereast commentedShoot, 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.
Comment #11
chrissnyderComment #12
chrissnyderComment #15
chrissnyderFixed in 3.1.2