RocketChat / RocketChat/Rocket.Chat

Discussion creation from `pmid` auto invites deactivated message authors

Open
#38,918 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

When creating a discussion from a message (rooms.createDiscussion with pmid), the original message author is automatically included in the invite list.
Currently, this auto-invite path does not check whether that user is deactivated.

Current behavior

In apps/meteor/app/discussion/server/methods/createDiscussion.ts, the invite list is built as:

  • message ? [message.u.username, ...users] : users

This means the message author is included even if active: false.

Expected behavior

Deactivated users should not be auto invited when creating discussions from a message.
If a username is deactivated, it should be filtered out before room creation.

Why this matters
  • Keeps membership behavior consistent with “active users only” expectations.
  • Avoids attempts to include inactive accounts in new discussion participants.
  • Reduces edge case permission/subscription inconsistencies.
Minimal reproduction
  1. Create user u1 and ensure they can post in a channel.
  2. u1 sends a message in channel C.
  3. Deactivate u1 (users.setActiveStatus, activeStatus: false).
  4. Another active user creates a discussion from u1’s message (pmid set).
  5. Observe that u1 is currently considered for auto-invite.
Suggested fix

In discussion creation flow:

  1. Build candidate usernames (message author + users[]).
  2. Resolve usernames to active users only.
  3. Pass only active usernames to createRoom.
Acceptance criteria
  • Deactivated message authors are not auto-invited to newly created discussions.
  • Deactivated usernames in users[] are ignored.
  • Add an end-to-end test under /rooms.createDiscussion covering this case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/meteor/app/discussion/server/methods/createDiscussion.ts and trace the /rooms.createDiscussion flow for pmid and users. Add or update the end-to-end test under /rooms.createDiscussion to cover a deactivated message author and deactivated usernames in users[]. Done means inactive users are excluded from newly created discussion invites.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.