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.
How It Works
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!).
Admin Configuration
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.
How We Built It
For the code curious among us, check out this PR to see how this feature was implemented:
Expand @-mention functionality to posts #13367
What type of PR is this? (check all applicable)
- [x] Feature
Description
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
/notification
page - [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
Completes https://github.com/forem/rfcs/pull/22!
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, vaidehijoshi
).
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!
Added tests?
- [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.
Changelog: Autocomplete for user mentions
Suzanne Aitchison ・ Mar 31 ・ 1 min read
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! 🎉
Top comments (4)
Wonderful! I requested this feature in one of my issues!
Add autocomplete mention for users while writing articles #11635
Is your feature request related to a problem? Please describe.
When I want to add a post of another DEV user, currently I have to copy their profile link and make it look like the person is actually tagged. Like this in markdown:
Describe the solution you'd like
I want that we should have the following feature while we tag others in a post or a comment etc:
As soon as I type '@' and type in a few letters of a username, a list should pop-up of a similar username from which I can pick the one I want.
The tagged person should be notified.
When someone clicks the tagged username, they should be redirected to their profile link.
Describe alternatives you've considered
N/A
Additional context
Here's something similar:
Or this:
Love it!!! Thanks for this. 🙂
Owwww niiiiiiiiiiiice !
yipee!