FEATURE: dismiss first notification on click anywhere (PR #9525)

Quicker jumpstart for those already familiar with the platform:

Allow dismissal of first notification mask from any click. On the dismissal click, we also need to send a “yes I saw it” confirmation by grabbing a batch of notifications. This prevents the dialog from appearing again on refresh, or other browsers and ensures we only see it once.


I don’t love adding a click handler in a widget init().

It might be easier to add the click handler in the header component didInsertElement. Then you could trigger an appEvent that this widget listens to.

@eviltrout That’s right, I forgot about app events for widgets - I’ve moved the addition of the event listener out to the site-header component :+1:

Hopefully this looks a bit better!

There should be an equivalent removeEventListener in the willDestroyElement.

(I realize in normal Discourse operation the header is never removed, but in an test environment you want to make sure to get this stuff right.)

That’s what I get for brain fogging my way through this, thanks for catching that - I was thinking that because it was a “once” event, it’d remove itself (in most cases), but I was forgetting about test case cleanup! Updated once more.

Thanks! Looks great now.

Oops, just needed to shuffle the event function around a little bit to make the closures correct, it works and I can merge it now. :+1:

This pull request has been mentioned on Discourse Meta. There might be relevant details there: