I'm pleased to announce that, starting today, @-mentioning other Forem users in a post will trigger a notification for the mentioned user! This feature mirrors the functionality that already existed when mentioning a user in a comment, and extends that same behavior to posts as well.
With this new feature, whenever a user mentions another user in a published post, the mentioned user will receive a notification informing them that they were mentioned.
Notably, mentioning another user in a draft post will not trigger any notifications. We've also built this feature to ensure that you will only ever receive one notification per post; if you follow another author and that author mentions you, you will only receive a single @-mention notification (we don't want to spam you with notifications!).
We take safety seriously at Forem, and in order to mitigate the risk of potential spam and abuse, we've capped the maximum number of times a user can @-mention other users in posts and comments.
Forem admins can configure this setting in the "Rate Limits & Anti-Spam" section of the Admin Configuration page.
For the code curious among us, check out this PR to see how this feature was implemented:
What type of PR is this? (check all applicable)
- [x] Feature
This PR completes the final piece of functionality to fully ship RFC #22!
Per the RFC's design/definition of done, this PR does the following:
- [x] Allows articles to have mentions
- [x] Sends users who are mentioned in an article a single notification
- [x] Ensures that the correct notification shows up on the mentioned user's
- [x] Ensures that a user only receives one notification per article (if a user follows an author/organization but also happen to be @-mentioned in the article, they only receive the @-mention notification, and no other article notifications)
- [x] Updates relevant views and mailer templates
- [x] Adds a TON of specs
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
To QA this PR, open up two browser windows, each with two different users. In this case, I have User A (Admin user) and User B (my user,
Part 1: Testing @-mentions while following a user
- Start by having User B follow User A. In User A's account, create an article, and mention User B:
Part 2: Testing normal article published notifications
- Now, create a new article from User A's account. This time, DO NOT mention User B.
Part 3: Testing embedded mentions
- Find a comment that mentions User B (any comment should do!). For example:
Part 4: Other oddities
- Try testing this functionality out with both editors; the functionality should be exactly the same:
UI accessibility concerns?
This is mostly backend work, and the frontend work is reusing HTML markup code that already exists so, hopefully not!
- [x] You bet I did
[Forem core team only] How will this change be communicated?
- [x] I will share this change in a Changelog or in a forem.dev post
- [x] I will share this change internally with the appropriate teams
Are there any post deployment tasks we need to perform?
Nothing special, nope! Just want to be sure to QA thoroughly and try it out on DEV before rolling it out to the fleet.
What gif best describes this PR or how it makes you feel?
This feature rides on the coattails of the fantastic work that @s_aitchison recently shipped to overhaul our editor's handling of autocomplete for user mentions.
We're very excited to have this highly-requested feature live for all Forem users starting today! As always, you can report any issues in our repository. Please try it out and let us know what you think.
Happy mentioning! 🎉