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

Abierto
#43,391 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@mayank609 ya está trabajando en esto.

Desde el 31/10/2026.

  • #43392 de @mayank609 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
46.5k
Forks
14.1k
Merge medio
1 d 21 h
PR fusionados (30 d)
381

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RocketChat/Rocket.Chat

Todos los issues de RocketChat/Rocket.Chat

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.