Records Feature record

FDR-006

@Mentions

Active Last reviewed 2026-11-02 Source file

Overview

Users can mention users, roles, and room-scoped virtual groups with @handle syntax. An eligible delivered mention creates a notification occurrence, contributes to the room's unread-notification indicator, and renders as styled text in the message body.

Behavior

  • Typing @ followed by at least one character opens the autocomplete popup in the composer.
  • Matching is fuzzy against room-member logins, room-member display names, the virtual handles all and here, and pingable role names. An exact room-wide handle ranks above partial member matches. A room-wide prefix ranks above substring and fuzzy member matches, except for prioritized thread participants.
  • While the room list loads, autocomplete combines loaded members with server search results.
  • In a thread composer, thread participants rank above other matching members. An exact login or display-name match ranks first. The current user does not get this priority. Tab completion uses the same order as the popup.
  • Arrow keys move the selection. Tab, Shift+Tab, Enter, or a click confirms the highlighted match with a trailing space without sending the message. The space can be removed with Backspace. Space remains available for typing and closes the suggestions.
  • @username mentions select that human or bot account when it is a current room member. Universal room implicit members count as room members; notification policy still decides whether to create an occurrence.
  • Pingable @role mentions select current room members who are explicitly assigned that role. Universal room implicit members count as room members; each recipient's policy still applies.
  • @owner and @admin are ordinary role handles but are not pingable by default, so they do not appear in autocomplete and do not notify unless an operator explicitly enables them.
  • Fresh servers seed the moderator role as pingable. It remains an explicit role ping: it reaches users assigned to moderator, not admins or owners unless those users also have the moderator role.
  • @all mentions every current room member, regardless of presence.
  • @here mentions current room members whose presence is not offline.
  • @everyone is not a message mention handle. Use @all for room-wide delivery; everyone remains the implicit RBAC role.
  • Valid user, role, and virtual mentions render with highlight styling in the posted message. User mentions show the current display name, with @ before it; role and virtual mentions keep their handles. Self-mentions get additional styling.
  • Clicking or right-clicking a user mention opens that user's menu.
  • Resolved user mentions stay visible while a connection recovers. Unchanged profiles do not require another mention lookup. After a recovery gap, the client checks membership again and removes matches that are no longer valid. Access loss and privacy resets clear retained matches.
  • Mentions inside code spans, code blocks, pre-formatted text, and blockquotes do not resolve, notify, or receive mention styling.
  • Mentions inside links and URLs do not resolve, notify, or receive mention styling. This includes link labels, link destinations, and URLs that the renderer converts to links, with or without a scheme. For example, https://social.example.com/@alice/123 keeps its literal text.
  • An @ directly after a letter or digit, as in user@example.com, does not start a mention. Other characters before @ do not block a mention, so @alice/@bob mentions both users.
  • Mentioning yourself does not produce a notification.
  • Mentioning a user who isn't a room member leaves the @name as plain text — the mention is not delivered.
  • The bundled composer asks for confirmation before sending a message that mentions any role or room-wide virtual handle (@all or @here).
  • Mentions are resolved when a message is first posted. Editing a message later does not add, remove, dismiss, or re-send mention notifications.
  • A delivered direct @username mention in a channel-room root or reply attempts to follow that thread for the mentioned account if it has no prior follow state. The root message ID identifies the thread for a root mention. Role mentions, @all, and @here do not auto-follow recipients.
  • A direct mention from another account creates a durable interaction relationship with the message's channel-room thread. With message.read-interactions, that relationship authorizes the complete thread. Self, role, @all, and @here mentions do not create this access.

Design Decisions

1. One shared @ namespace

Decision: Users, roles, and virtual handles all use @handle. User logins cannot use existing role names or virtual handles, and custom role names cannot use existing user logins or virtual handles. A mentionables model derives the shared handle map from existing user and RBAC events; handle-changing user and role writes check that projection under a stream-wide OCC boundary so concurrent user/role writes cannot commit the same mention handle. Why: Users already understand @ as "direct attention". A second prefix would make role mentions harder to discover and harder to tab-complete. A single case-insensitive namespace keeps parsing and autocomplete predictable. Tradeoff: A server cannot have a user and role with the same mention handle. Early 0.1.x servers can resolve any existing collisions manually.

2. Mentions are room-scoped

Decision: Mentions only deliver to users who are current members of the room being posted to. Room membership means effective membership: explicit membership plus implicit membership in Universal channel rooms for users who are currently eligible to join. Role mentions intersect explicit role membership with room membership, and only roles marked pingable resolve as role pings. Why: Room membership is the visibility boundary for the message. Notifying a non-member would either leak context or create a notification they cannot open. Tradeoff: A role mention may reach fewer people than the full role assignment list. Authors who need a broader audience must post in a room that contains that audience.

3. Role pingability is explicit

Decision: Each role carries a pingable setting. Fresh servers seed moderator as pingable and leave owner, admin, and everyone unpingable. Existing servers are not backfilled; operators can enable pingability through role settings. Why: Operational helper groups like moderators are useful to ping, but authority roles are easy to abuse as attention targets. Making pingability explicit lets operators choose their moderation workflow without making every powerful role a paging group. Tradeoff: Existing roles may need one admin UI change before they appear in autocomplete or deliver role pings.

4. Mentions are post-time facts

Decision: Mention delivery is decided when the message is posted. Later edits may change the visible message body, but they do not re-resolve mentions, change who was notified, or remove a derived thread interaction relationship. Why: A mention notification is an attention event that already happened. Re-resolving mentions on edit would allow quiet retroactive pings, would make notifications depend on mutable usernames and edited body text, and would complicate replay now that message bodies are private payload facts. Tradeoff: An author who forgot to mention someone must send a new message rather than editing the old one to ping them. Removing an @name from the edited body also does not revoke an already-created notification.

5. Echoes resolve mentions without new notifications

Decision: Echo reads resolve mention metadata from the original reply. The echo does not fire a second notification. Why: Both views need the same mention display. Each recipient needs only one notification. See FDR-003. Tradeoff: The backend resolves the original metadata for timeline and realtime reads and skips notification creation for echoes.

6. Direct-mention policy controls delivery

Decision: A rendered mention produces an occurrence only when its specific mention cause resolves to Notification or Push notification for the recipient; Off suppresses it. Why: Direct, role, @here, and @all mentions need independent attention policy instead of one coarse room mute. See FDR-012. Tradeoff: Users can deliberately suppress directed mentions in a room and may miss them.

7. Mention attention state is a notification

Decision: An eligible delivered mention creates a notification occurrence. Sidebar mention indicators derive from unread occurrences, not from a separate room-level mention-status key. Why: Mention attention state has the same read, delete, cross-device, and retention lifecycle as other notifications. Keeping it in the notification model avoids duplicated state. Tradeoff: Marking the occurrence read or reading through its target clears the corresponding unread sidebar attention signal while retaining the notification item.

8. Direct mentions can subscribe the recipient

Decision: When a direct @username mention is delivered in a channel-room root or reply, Chatto attempts a post-commit thread-follow event for the mentioned account only if it has no prior follow state. The root message is the thread root when the mention is in a root. An explicit unfollow suppresses mention-driven re-follow, but normal notification rules can still create the mention occurrence. Why: A direct channel-room mention usually means the thread now concerns the recipient, so it should appear in My Threads by default. An explicit unfollow is a stronger preference and should not be replaced by another account's later mention. Tradeoff: The follow write is best-effort after the source message commits, so a transient failure can omit the subscription without losing the message or mention notification. Broadcast and role mentions do not populate My Threads for every recipient; authors who need someone to track a thread should mention that user directly.

9. Role and room-wide sends use client-side confirmation

Decision: The bundled composer prompts before posting any message that mentions a role or the room-wide virtual handles @all or @here. The prompt is client-side only; the public MessageService.CreateMessage API posts authorized messages directly and does not issue or require a mention confirmation token. Notification fanout is still resolved server-side at post time after deduplication, excluding the author, applying effective membership, and suppressing each cause that resolves to Off for that recipient and room. Multiple matching role handles for one recipient produce one role-mention occurrence that retains the matching handles; direct, role, @here, and @all remain distinct causes. Why: Role and room-wide mentions are useful operational tools, but accidental broad pings are costly. Confirmation preserves the feature while catching the common "I did not realize this reaches everyone" mistake. Tradeoff: Integrators are responsible for their own UX friction when they expose role or room-wide mention sending, while the bundled client keeps the safeguard without adding a token round-trip to the integration API.

10. Mentions come from the parsed message tree

Decision: The server and the bundled frontend find mentions in the parsed Markdown tree, not in the raw text or in the rendered HTML. Only plain text outside code, blockquotes, and links can contain a mention. URLs become links before mention recognition, so a handle in a URL stays URL text. The frontend marks each mention candidate while it renders the message. A later step only resolves those marked candidates against room members, roles, and virtual handles. The server skips the same URLs by applying the frontend's URL rules to the message source. A shared set of cases in testdata/mentions/extraction.json runs against both implementations. Why: A mention must notify exactly the handles that the message shows as mentions. A text pass after rendering cannot tell a URL or link label from prose. A rule based only on the character before @ cannot tell example.social/@alice from @alice/@bob. Tradeoff: The server and the frontend use different Markdown and URL libraries, so their agreement depends on the shared cases. A URL form that the shared cases do not cover can still be interpreted differently. Known differences are rare URL forms: URLs that contain Markdown syntax, an entity, a quote, |, ^, ?@, or #@; a scheme directly after a letter; _ in a host name; IPv6 or punycode hosts; email-like text such as cc:@alice.dev; a backslash escape inside a link destination or title; and inline code that crosses a table cell boundary. Add a case when a difference is found.

Permissions

No dedicated mention permission. Anyone who can post in a room can mention any user, role, or virtual handle that resolves inside that room.

  • ADRs: ADR-026 (event identity via NanoID), ADR-076 (deterministic notification occurrences), ADR-077 (persistent notification list), ADR-080 (explicit message-read permissions), ADR-082 (derived thread interactions)
  • FDRs: FDR-002 (Replies & Threads), FDR-003 (Thread Reply Echo), FDR-012 (Notifications), FDR-013 (Web Push Notifications), FDR-032 (Message Formatting), FDR-039 (Message Access & Interactions)

Records that name this record

Esc