Improve logic for marking at-mention notifications as read
In previous iterations, at-mention notifications were marked as read in the
following cases:
- when a user visited his own activity page
- when a user visited his own mention page
- when a user visited a single-activity permalink page
When the new notifications component was introduced in BP 1.9, the old
notification functions were swapped out one-for-one with the new correlates.
However, this introduced a bug where a logged-out user visiting one of the
pages listed above would mark at-mention items as read for *all* users (due to
the user_id field being null, and the user_id WHERE clause being excluded from
the UPDATE query).
We take this bug as an opportunity to narrow the circumstances in which
at-mention notifications are marked as read. The new system:
- When a user visits his own mention page, mark all his at-mention notifications
as read
- When a user visits the permalink page of a single activity item in which he
is mentioned, mark that specific at-mention notification as read
Fixes #5384
Props SlothLoveChunk for an initial patch