Sentence-ending period is included in user and channel mentions ("thanks @john." mentions "john.")

Aperta
#43,391 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@mayank609 ci sta già lavorando.

Dal 31/10/2026.

  • #43392 di @mayank609 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
20/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript

Direzione di ricerca

The issue points to UserMentionDirect, ChannelMention, and UTF8NamesValidation in @rocket.chat/message-parser, and cites tests/mention.test.ts. Read the existing mention tests and inspect how trailing punctuation is parsed. Done means sentence-ending periods are excluded from mentions while the existing username-ending-in-period case is addressed; the issue says a fix and tests are already in a PR.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: bug
Description

When a message ends a sentence with a mention, the period is parsed as part of the username or channel name.

Input Parsed mention Expected
thanks @john. john. john
see #general. general. general
@john... john... john

! and ? already work as expected (ask @john! mentions john), so only . is affected.

Since Mentions.execute builds message.mentions from the parsed message.md when it exists, the server then looks up a user named john.. As far as I can tell this means the intended user isn't added to mentions and doesn't get the mention notification or highlight.

Steps to reproduce
  1. Send thanks @<existing username>. in a room.
  2. The mention isn't rendered or notified for that user.

In @rocket.chat/message-parser:

parse('thanks @john.');
// MENTION_USER 'john.' instead of MENTION_USER 'john' + PLAIN_TEXT '.'
Cause

UserMentionDirect and ChannelMention use UTF8NamesValidation = $([-_.] / AlphaNumericChar)+, which accepts a trailing ..

Trade-off to discuss

The default UTF8_User_Names_Validation ([0-9a-zA-Z-_.]+) technically allows usernames that end in ., and tests/mention.test.ts currently expects @guilherme.gazzo. to mention guilherme.gazzo.. Dropping the trailing period would change that case. Ending a sentence with a mention seems much more common than a username ending in ., and this matches how Slack, GitHub and Discord handle it, but I'd like a maintainer's view on whether the change is acceptable.

I've opened a PR with a fix and tests.

Lingua principale
TypeScript
Stelle
46.5k
Fork
14.1k
Merge medio
1g 21h
PR unite (30g)
381

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RocketChat/Rocket.Chat

Tutte le issue di RocketChat/Rocket.Chat

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.