Repository navigation
feat: add rooms.join endpoint for all room types #40996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
661be04
feat: add rooms.join endpoint for all room types
ggazzo 2aabed4
chore: point joinRoom deprecation to rooms.join
ggazzo 309584d
test: add e2e coverage for rooms.join endpoint
ggazzo 391fcd6
test(e2e): add Playwright coverage for rooms.join
ggazzo 12cac3e
test(e2e): cover joining a discussion inside a private channel
ggazzo 3af6a9b
test(e2e): open private discussion via /group route and preview composer
ggazzo a11fbf4
test(e2e): remove test.only from private discussion test
ggazzo 2cb157b
fix(client): refresh room view after joining
ggazzo b52aead
Update apps/meteor/tests/e2e/rooms-join.spec.ts
ggazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@rocket.chat/meteor": minor | ||
| "@rocket.chat/rest-typings": minor | ||
| --- | ||
|
|
||
| Added a new `rooms.join` REST endpoint that lets a user join any room type, replicating the behavior of the deprecated `joinRoom` DDP method. Unlike `channels.join`, it resolves all room types through the shared `Room.join` service (access checks, join codes, federation and omnichannel rules). The client now uses `rooms.join` instead of `channels.join`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { Users } from './fixtures/userStates'; | ||
| import { HomeChannel } from './page-objects'; | ||
| import { createTargetChannel, createTargetDiscussion, deleteRoom, sendTargetChannelMessage } from './utils'; | ||
| import { test, expect } from './utils/test'; | ||
|
|
||
| test.use({ storageState: Users.admin.state }); | ||
|
|
||
| test.describe.serial('rooms.join', () => { | ||
| let poHomeChannel: HomeChannel; | ||
|
|
||
| test.beforeAll(async ({ api }) => { | ||
| // restrict preview to admin so a regular user lands on the "not subscribed" | ||
| // screen, whose "Join channel" button drives /v1/rooms.join via useJoinRoom | ||
| await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin'] }] }); | ||
| }); | ||
|
|
||
| test.afterAll(async ({ api }) => { | ||
| await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] }); | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
|
||
| poHomeChannel = new HomeChannel(page); | ||
| await page.goto('/home'); | ||
| }); | ||
|
|
||
| test.describe('public channel', () => { | ||
| test.use({ storageState: Users.user1.state }); | ||
|
|
||
| let targetChannel: string; | ||
|
|
||
| test.beforeAll(async ({ api }) => { | ||
| targetChannel = await createTargetChannel(api); | ||
| await sendTargetChannelMessage(api, targetChannel, { msg: 'message from a channel the user has not joined' }); | ||
| }); | ||
|
|
||
| test.afterAll(async ({ api }) => { | ||
| await api.post('/channels.delete', { roomName: targetChannel }); | ||
| }); | ||
|
|
||
| test('should let a non-member join a public channel', async ({ page }) => { | ||
| await page.goto(`/channel/${targetChannel}`); | ||
|
|
||
| await expect(poHomeChannel.btnJoinChannel).toBeVisible(); | ||
|
|
||
| await poHomeChannel.btnJoinChannel.click(); | ||
|
|
||
| await expect(poHomeChannel.btnJoinChannel).not.toBeVisible(); | ||
| await expect(poHomeChannel.composer.inputMessage).toBeEnabled(); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe('discussion', () => { | ||
| test.use({ storageState: Users.user1.state }); | ||
|
|
||
| let discussion: Record<string, string>; | ||
|
|
||
| test.beforeAll(async ({ api }) => { | ||
| discussion = await createTargetDiscussion(api); | ||
| }); | ||
|
|
||
| test.afterAll(async ({ api }) => { | ||
| await deleteRoom(api, discussion._id); | ||
| }); | ||
|
|
||
| test('should let a non-member join a discussion', async ({ page }) => { | ||
| await page.goto(`/channel/${discussion.name}`); | ||
|
|
||
| await expect(poHomeChannel.btnJoinChannel).toBeVisible(); | ||
|
|
||
| await poHomeChannel.btnJoinChannel.click(); | ||
|
|
||
| await expect(poHomeChannel.btnJoinChannel).not.toBeVisible(); | ||
| await expect(poHomeChannel.composer.inputMessage).toBeEnabled(); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.