Support @username mentions in blog entry content #31

Closed
opened 2024-01-14 14:34:40 -06:00 by jimmyb · 3 comments
Owner

Blog entries and blog entry comments should support @username mentions so authors and commenters can reference other MyVideoGameList users directly. Valid mentions should render as profile links, and mentioned users can opt in to email notifications separately for blog entries and blog entry comments.

In the current Laravel checkout, blog entry persistence, public blog pages, Markdown previews, and blog comments are rebuilt through BlogEntryController, BlogCommentController, BlogEntry, and BlogComment. Profile routes already provide canonical links for mentioned users, and the existing notification preference row supports opt-in email notification behavior.

Scope

  • Blog entry body/content rendering on index, show, and preview surfaces.
  • Blog entry comment rendering.
  • Matching active users by exact username.
  • Linking valid mentions to canonical profile routes.
  • Safe rendering that does not expose HTML/script injection.
  • Two user notification preferences:
    • mentioned in a blog entry
    • mentioned in a blog entry comment
  • Email notification delivery when opted-in users are mentioned on first public publish or new public-entry comment creation.
  • No site notification inbox or database notification UI in this issue.

Acceptance Criteria

  • Published blog entry content renders valid @username mentions as links to that user's profile.
  • Blog entry comments render valid @username mentions as links to that user's profile.
  • Mention links use the existing canonical profile route.
  • Mentions only link active, non-banned, non-deleted, non-soft-deleted users.
  • Unknown, banned, deleted, or soft-deleted usernames remain plain text.
  • Mention matching supports the app's existing username characters and does not consume surrounding punctuation.
  • Rendering is safe: malicious mention text, Markdown, and HTML cannot inject unsafe output.
  • Mentions inside existing Markdown content render without breaking Markdown formatting.
  • Mention parsing does not create activity-log entries.
  • Users can opt into email notifications for blog-entry mentions and blog-entry-comment mentions separately from Settings > Notifications.
  • Blog entry mention emails send only when a public entry is first published.
  • Blog entry comment mention emails send only when a new comment is posted on a published public entry.
  • Mention emails do not send for drafts, private/friends-only entries, unpublished entries, edits, unknown users, inactive users, users who have not opted in, or the author/commenter mentioning themselves.
  • User-facing UI supports light/dark mode and follows existing Laravel/Tailwind blog/profile patterns.

Test Coverage Required

  • Unit tests for mention parsing and rendering, including valid usernames, unknown usernames, punctuation, repeated mentions, and case sensitivity.
  • Unit/security tests confirming mention rendering escapes unsafe content and does not allow script injection.
  • Feature tests confirming public blog entries render valid mention links to user profiles.
  • Feature tests confirming blog comments render valid mention links to user profiles.
  • Feature tests confirming banned, deleted, and soft-deleted users are not linked.
  • Feature tests confirming blog entry mention emails respect the new notification setting and only send on first public publish.
  • Feature tests confirming blog comment mention emails respect the new notification setting and only send for new comments on public entries.
  • Settings tests confirming both notification toggles load, save, and only update the authenticated user's row.
  • Registration/default-setting tests confirming new notification settings default to off.
  • Run focused mention/blog/settings tests, then run vendor/bin/pint --dirty --format agent before closing the issue.

Progress Checklist

  • Profile routes exist for linking mentioned users
  • Blog entry persistence and public blog entry rendering exist
  • Blog entry comments exist
  • Profile/header links reserve user blog pages
  • Profile stats include Blog Entries and Blog Views rows
  • Recent Gamer Updates supports blog_entry_published
  • Add reusable mention parsing/rendering support for blog entry content and comments
  • Link valid active usernames to profile pages
  • Leave invalid/unavailable usernames as plain text
  • Preserve safe Markdown/HTML rendering behavior
  • Add separate notification preferences for blog entry and blog comment mentions
  • Send opted-in email notifications on first public publish and new public-entry comments
  • Avoid notification delivery for edits, private/friends-only entries, inactive users, unknown users, and self-mentions
  • Add tests for parsing, rendering, profile links, safety, unavailable users, settings, and notification delivery/suppression
Blog entries and blog entry comments should support `@username` mentions so authors and commenters can reference other MyVideoGameList users directly. Valid mentions should render as profile links, and mentioned users can opt in to email notifications separately for blog entries and blog entry comments. In the current Laravel checkout, blog entry persistence, public blog pages, Markdown previews, and blog comments are rebuilt through `BlogEntryController`, `BlogCommentController`, `BlogEntry`, and `BlogComment`. Profile routes already provide canonical links for mentioned users, and the existing notification preference row supports opt-in email notification behavior. ## Scope - Blog entry body/content rendering on index, show, and preview surfaces. - Blog entry comment rendering. - Matching active users by exact username. - Linking valid mentions to canonical profile routes. - Safe rendering that does not expose HTML/script injection. - Two user notification preferences: - mentioned in a blog entry - mentioned in a blog entry comment - Email notification delivery when opted-in users are mentioned on first public publish or new public-entry comment creation. - No site notification inbox or database notification UI in this issue. ## Acceptance Criteria - Published blog entry content renders valid `@username` mentions as links to that user's profile. - Blog entry comments render valid `@username` mentions as links to that user's profile. - Mention links use the existing canonical profile route. - Mentions only link active, non-banned, non-deleted, non-soft-deleted users. - Unknown, banned, deleted, or soft-deleted usernames remain plain text. - Mention matching supports the app's existing username characters and does not consume surrounding punctuation. - Rendering is safe: malicious mention text, Markdown, and HTML cannot inject unsafe output. - Mentions inside existing Markdown content render without breaking Markdown formatting. - Mention parsing does not create activity-log entries. - Users can opt into email notifications for blog-entry mentions and blog-entry-comment mentions separately from Settings > Notifications. - Blog entry mention emails send only when a public entry is first published. - Blog entry comment mention emails send only when a new comment is posted on a published public entry. - Mention emails do not send for drafts, private/friends-only entries, unpublished entries, edits, unknown users, inactive users, users who have not opted in, or the author/commenter mentioning themselves. - User-facing UI supports light/dark mode and follows existing Laravel/Tailwind blog/profile patterns. ## Test Coverage Required - Unit tests for mention parsing and rendering, including valid usernames, unknown usernames, punctuation, repeated mentions, and case sensitivity. - Unit/security tests confirming mention rendering escapes unsafe content and does not allow script injection. - Feature tests confirming public blog entries render valid mention links to user profiles. - Feature tests confirming blog comments render valid mention links to user profiles. - Feature tests confirming banned, deleted, and soft-deleted users are not linked. - Feature tests confirming blog entry mention emails respect the new notification setting and only send on first public publish. - Feature tests confirming blog comment mention emails respect the new notification setting and only send for new comments on public entries. - Settings tests confirming both notification toggles load, save, and only update the authenticated user's row. - Registration/default-setting tests confirming new notification settings default to off. - Run focused mention/blog/settings tests, then run `vendor/bin/pint --dirty --format agent` before closing the issue. ## Progress Checklist - [x] Profile routes exist for linking mentioned users - [x] Blog entry persistence and public blog entry rendering exist - [x] Blog entry comments exist - [x] Profile/header links reserve user blog pages - [x] Profile stats include Blog Entries and Blog Views rows - [x] Recent Gamer Updates supports `blog_entry_published` - [x] Add reusable mention parsing/rendering support for blog entry content and comments - [x] Link valid active usernames to profile pages - [x] Leave invalid/unavailable usernames as plain text - [x] Preserve safe Markdown/HTML rendering behavior - [x] Add separate notification preferences for blog entry and blog comment mentions - [x] Send opted-in email notifications on first public publish and new public-entry comments - [x] Avoid notification delivery for edits, private/friends-only entries, inactive users, unknown users, and self-mentions - [x] Add tests for parsing, rendering, profile links, safety, unavailable users, settings, and notification delivery/suppression
Author
Owner

Originally posted by Vilkathewolf

Does this also mean that the person will be notified that they've been mentioned?

Also instead of just blog entries, maybe comments too?

Love the idea though, I'm for it.

**Originally posted by Vilkathewolf** Does this also mean that the person will be notified that they've been mentioned? Also instead of just blog entries, maybe comments too? Love the idea though, I'm for it.
Author
Owner

@VilkaTheWolf This issue only covers using the @ mention in a blog entry. Notifications and using @ mentions in blog entry comments are both good ideas too. I'd recommend creating a new issue for each one if you wanna see either in future versions of the site! 👍

@VilkaTheWolf This issue only covers using the @ mention in a blog entry. Notifications and using @ mentions in blog entry comments are both good ideas too. I'd recommend creating a new issue for each one if you wanna see either in future versions of the site! 👍
Codex changed title from Allow @ username Mentioning in Blog Entries to Support @username mentions in blog entry content 2026-05-26 00:56:00 -05:00
jimmyb self-assigned this 2026-06-03 18:23:05 -05:00
Member

Implemented and pushed in 061f16d (Add blog mention notifications).

Notes for review/maintenance:

  • Added reusable blog mention parsing/rendering for blog entries, previews, and blog comments.
  • Valid active @username mentions link to canonical profile routes; unknown, banned, user-deleted, and soft-deleted users remain plain text.
  • Added separate opt-in email notification settings for blog entry mentions and blog entry comment mentions. Defaults are off.
  • Email notifications fire only on first public publish for entries and on new comments for published public entries. Drafts, private/friends-only entries, edits, inactive users, users without the setting enabled, and self-mentions are suppressed.
  • This intentionally does not add a site notification inbox/database notification UI.
  • Added focused unit/feature coverage for parsing, safe rendering, profile links, notification delivery/suppression, settings persistence, registration defaults, sync tooling, and activity-log regressions.

Verification run:

  • php artisan test --compact tests/Unit/BlogMentionRendererTest.php
  • php artisan test --compact tests/Feature/BlogTest.php
  • php artisan test --compact tests/Feature/Settings/ProfileUpdateTest.php
  • php artisan test --compact tests/Feature/Auth/RegistrationTest.php
  • php artisan test --compact tests/Feature/SyncProdUserNotificationSettingsCommandTest.php
  • vendor/bin/pint --dirty --format agent
  • git diff --check
Implemented and pushed in `061f16d` (`Add blog mention notifications`). Notes for review/maintenance: - Added reusable blog mention parsing/rendering for blog entries, previews, and blog comments. - Valid active `@username` mentions link to canonical profile routes; unknown, banned, user-deleted, and soft-deleted users remain plain text. - Added separate opt-in email notification settings for blog entry mentions and blog entry comment mentions. Defaults are off. - Email notifications fire only on first public publish for entries and on new comments for published public entries. Drafts, private/friends-only entries, edits, inactive users, users without the setting enabled, and self-mentions are suppressed. - This intentionally does not add a site notification inbox/database notification UI. - Added focused unit/feature coverage for parsing, safe rendering, profile links, notification delivery/suppression, settings persistence, registration defaults, sync tooling, and activity-log regressions. Verification run: - `php artisan test --compact tests/Unit/BlogMentionRendererTest.php` - `php artisan test --compact tests/Feature/BlogTest.php` - `php artisan test --compact tests/Feature/Settings/ProfileUpdateTest.php` - `php artisan test --compact tests/Feature/Auth/RegistrationTest.php` - `php artisan test --compact tests/Feature/SyncProdUserNotificationSettingsCommandTest.php` - `vendor/bin/pint --dirty --format agent` - `git diff --check`
Codex 2026-06-03 18:53:26 -05:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MyVideoGameList/myvideogamelist.com#31
No description provided.