Avoiding multiple (annoying) alerts for non-core alert types #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed here, if you're using an extra pack of alerts or whatever plugin that supports MyAlerts, users can receive more than one notification for the same event. If you are a) mentioned, b) quoted in a c) reply of a thread you've made and d) you've subscribed to, MyAlerts will send you 4 alerts with the same purpose, assuming you've installed MentionMe + Plugins Alerts Pack.
This came up to my mind just now after months. I was looking for something to improve my MyAlerts extensions and got the solution scratching my head a little bit. It's quite easy but really effective as we can make a great use of PHP sessions to store subsequent calls and data to check whether if an alert has been already delivered for that specific thread or not and act dependently on it.
It's just easy as this snippet. We check for both the tid and the type of alert because if you reply to a thread, the user sees the alert and you reply once again to the same thread, the tid will be the same and the alert won't be generated (we want at least one to be delivered 馃槃).
This seems the best solution with a transparent approach to me. No wasted queries and just a small change to make the MyAlerts experience much smarter for both developers and users.