Skip to content
Snippets Groups Projects
Unverified Commit e9fb44a0 authored by Yash Rajpal's avatar Yash Rajpal Committed by GitHub
Browse files

fix: Disabled E2EE room instances creation (#32857)

parent a0578b16
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': patch
---
Fixed some anomalies related to disabled E2EE rooms. Earlier there are some weird issues with disabled E2EE rooms, this PR fixes these anomalies.
......@@ -257,7 +257,7 @@ class E2E extends Emitter {
return null;
}
if (room.encrypted !== true && !room.e2eKeyId) {
if (!room.encrypted) {
return null;
}
......
......@@ -344,7 +344,9 @@ test.describe.serial('e2e-encryption', () => {
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();
});
test('expect placeholder text in place of encrypted file description, when E2EE is not setup', async ({ page }) => {
test('expect placeholder text in place of encrypted file description, when E2EE is not setup and non-encrypted files upload in disabled e2ee room', async ({
page,
}) => {
const channelName = faker.string.uuid();
await poHomeChannel.sidenav.openNewByLabel('Channel');
......@@ -368,6 +370,42 @@ test.describe.serial('e2e-encryption', () => {
await expect(poHomeChannel.content.getFileDescription).toHaveText('any_description');
await expect(poHomeChannel.content.lastMessageFileName).toContainText('any_file1.txt');
await test.step('disable E2EE in the room', async () => {
await poHomeChannel.tabs.kebab.click();
await expect(poHomeChannel.tabs.btnDisableE2E).toBeVisible();
await poHomeChannel.tabs.btnDisableE2E.click();
await poHomeChannel.dismissToast();
// will wait till the key icon in header goes away
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toHaveCount(0);
});
await page.reload();
await test.step('upload the file in disabled E2EE room', async () => {
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).not.toBeVisible();
await poHomeChannel.content.dragAndDropTxtFile();
await poHomeChannel.content.descriptionInput.fill('any_description');
await poHomeChannel.content.fileNameInput.fill('any_file1.txt');
await poHomeChannel.content.btnModalConfirm.click();
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).not.toBeVisible();
await expect(poHomeChannel.content.getFileDescription).toHaveText('any_description');
await expect(poHomeChannel.content.lastMessageFileName).toContainText('any_file1.txt');
});
await test.step('Enable E2EE in the room', async () => {
await poHomeChannel.tabs.kebab.click();
await expect(poHomeChannel.tabs.btnEnableE2E).toBeVisible();
await poHomeChannel.tabs.btnEnableE2E.click();
await poHomeChannel.dismissToast();
// will wait till the key icon in header appears
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toHaveCount(1);
});
// Logout to remove e2ee keys
await poHomeChannel.sidenav.logout();
......@@ -380,10 +418,10 @@ test.describe.serial('e2e-encryption', () => {
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible();
await expect(poHomeChannel.content.lastUserMessage).toContainText(
await expect(poHomeChannel.content.nthMessage(0)).toContainText(
'This message is end-to-end encrypted. To view it, you must enter your encryption key in your account settings.',
);
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();
await expect(poHomeChannel.content.nthMessage(0).locator('.rcx-icon--name-key')).toBeVisible();
});
test('expect slash commands to be enabled in an e2ee room', async ({ page }) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment