Sentence-ending period is included in user and channel mentions ("thanks @john." mentions "john.")
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- backend-api-design
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Send
thanks @<existing username>.in a room. - 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.
- Dominant language
- TypeScript
- Stars
- 46.5k
- Forks
- 14.1k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 381
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RocketChat/Rocket.Chat
-
Mark the empty state busy while a new search loads, like the table */}Possibly taken @aditya25bcy10173-a11y claimed this 2 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RocketChat/Rocket.Chat#43699 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Timestamp with a time but no timezone shows as 1 January 1970Possibly taken @Sarthak-agrawal-tech claimed this 4 days ago. Opentype: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43637 · 6 comments ·
Maintainers usually reply within 1 day
-
Move this mapping from useQuery's old `select` into a usePaginatedQuery `combine`Possibly taken @aditya25bcy10173-a11y claimed this 3 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43609 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
evaluate switching to the other tab when the selected tab's permission is revoked mid-sessionPossibly taken @schizophrenicmaniac claimed this 4 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
RocketChat/Rocket.Chat#43579 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Docs say packages can be installed with `npm` but use unsupported `patch:` URLPossibly taken A pull request linked to this issue is open or already merged. Opentype: bug
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43554 · 4 comments ·
Maintainers usually reply within 1 day
All issues in RocketChat/Rocket.Chat
Similar issues
-
bug
Difficulty 2/5 Half a day Newbie friendliness 68/100
amosblomqvist/learnharness#758 ·
Maintainers usually reply within 2 days
-
Change WorkspacesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
bitfocus/companion-module-renewedvision-propresenter-api#134 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
rcpch/digital-growth-charts-react-component-library#304 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dsh-market/dsh-market#1210 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
trustjonathan/STUDY-HUB#13 ·