RocketChat / RocketChat/Rocket.Chat
[BUG] `createDirectRoom` server function ignores `subscriptionExtra.open` option
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
The subscriptionExtra options are splatted before the { open } option and thus will always defer to the member count check if the member is not the creator:
I believe these two lines should be reversed as such:
...(options?.creator !== member._id && { open: members.length > 2 }),
...options?.subscriptionExtra,
thus allowing calls to createDirectRoom with options: options.subscriptionExtra = { open: true } to be honoured.
Steps to reproduce:
Call createDirectRoom(['user1', 'user2'], {}, { subscriptionExtra: { open: true } })
OR
Post to the /api/v1/im.create endpoint with:
{
"usernames": "user1,user2",
"excludeSelf": true
}
(as a user with the view-room-administration permission)
Expected behavior:
For the direct room to be created, and the room "opened" for both users
Actual behavior:
The direct room is created, but is not opened for either user.
Server Setup Information:
- Version of Rocket.Chat Server: develop branch
Contributor 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.
Research direction
Start in apps/meteor/app/lib/server/functions/createDirectRoom.ts around lines 149-150 and inspect how subscriptionExtra and the open option are combined. Reproduce with createDirectRoom or the im.create API using the stated options; done when a direct room created with open: true is opened for both users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100