Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gold-cougars-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue that allowed agents without the `preview-c-room` permission to join a closed livechat conversation, creating a livechat room that could not be closed or removed from the sidebar.
2 changes: 1 addition & 1 deletion apps/meteor/client/views/room/hooks/useOpenRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function useOpenRoom({ type, reference }: { type: RoomType; reference: st
const sub = Subscriptions.findOne({ rid: room._id });

// if user doesn't exist at this point, anonymous read is enabled, otherwise an error would have been thrown
if (user && !sub && !hasPreviewPermission) {
if (user && !sub && !hasPreviewPermission && type !== 'l') {
Comment thread
MartinSchoeler marked this conversation as resolved.
Outdated
throw new NotSubscribedToRoomError(undefined, { rid: room._id });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ test.describe('Omnichannel chat history', () => {
await api.delete('/livechat/users/agent/user1');
await api.delete('/livechat/users/manager/user1');
await agent.page.close();

await api.post('/permissions.update', { permissions: [{ _id: 'view-c-room', roles: ['admin', 'owner', 'moderator', 'user'] }] });
Comment thread
MartinSchoeler marked this conversation as resolved.
Outdated
});

test('Receiving a message from visitor', async ({ page }) => {
test('Receiving a message from visitor', async ({ page, api }) => {
await test.step('Expect send a message as a visitor', async () => {
await page.goto('/livechat');
await poLiveChat.openLiveChat();
Expand Down Expand Up @@ -72,5 +74,17 @@ test.describe('Omnichannel chat history', () => {
await agent.poHomeOmnichannel.contacts.contactInfo.historyItem.click();
await expect(agent.poHomeOmnichannel.contacts.contactInfo.historyMessage).toBeVisible();
});

await api.post('/permissions.update', { permissions: [{ _id: 'view-c-room', roles: [] }] });

await test.step('Expect to not be able to see conversation history', async () => {
await agent.page.reload();

await agent.poHomeOmnichannel.contacts.contactInfo.historyItem.click();
await agent.poHomeOmnichannel.contacts.contactInfo.historyMessage.click();

// Should not show the NoSubscribedRoom.tsx component on livechat rooms
await expect(agent.page.getByRole('button', { name: 'Join_channel' })).not.toBeVisible();
Comment thread
MartinSchoeler marked this conversation as resolved.
Outdated
});
});
});