FIX: Restore dismissing the first notification (PR #10433)

Reverts the temporary fix (8e4fea897e68e4b50e548f820dc1f1fdeeeb199d) and restores the feature introduced in e638d43f0a7549a75eb9de57bb8508b36f11543d.

The issue that was the reason for the revert ( was a combination of two bugs:

  1. Fixed in this commit - the click listener was accidentally registered also for logged-out users. This meant that the first click on a page always trigger an AJAX call to the notifications endpoint (/notifications?recent=true&limit=5), which returned a 403 error. Now, this code is run only when the user is logged in.
  2. A still unknown bug that I could not reproduce, which was somehow setting the login redirect cookie to the URL of that previously failed AJAX request.


One thing that held me up from doing this was being able to test and be fairly sure we were not going to regress. Is there something we can be testing for this that wouldn’t be too difficult?