Skip to content

Commit

Permalink
fix: e2ee "copy link" action enabled in starred and pinned message li…
Browse files Browse the repository at this point in the history
…st (#32803)
  • Loading branch information
hugocostadev authored Jul 24, 2024
1 parent 03c8b06 commit f5ea2ff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-numbers-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed "Copy link" message action enabled in Starred and Pinned list for End to End Encrypted channels, this action is disabled now
4 changes: 4 additions & 0 deletions apps/meteor/client/startup/actionButtons/permalinkPinned.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isE2EEMessage } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { MessageAction } from '../../../app/ui-utils/client';
Expand Down Expand Up @@ -27,5 +28,8 @@ Meteor.startup(() => {
},
order: 5,
group: 'menu',
disabled({ message }) {
return isE2EEMessage(message);
},
});
});
4 changes: 4 additions & 0 deletions apps/meteor/client/startup/actionButtons/permalinkStar.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isE2EEMessage } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { MessageAction } from '../../../app/ui-utils/client';
Expand Down Expand Up @@ -32,5 +33,8 @@ Meteor.startup(() => {
},
order: 10,
group: 'menu',
disabled({ message }) {
return isE2EEMessage(message);
},
});
});
19 changes: 13 additions & 6 deletions apps/meteor/tests/e2e/e2e-encryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,19 +524,26 @@ test.describe.serial('e2e-encryption', () => {
await poHomeChannel.tabs.btnPinnedMessagesList.click();

await expect(page.getByRole('dialog', { name: 'Pinned Messages' })).toBeVisible();
await expect(page.getByRole('dialog', { name: 'Pinned Messages' }).locator('[data-qa-type="message"]').last()).toContainText(
'This message should be pinned and stared.',
);

const lastPinnedMessage = page.getByRole('dialog', { name: 'Pinned Messages' }).locator('[data-qa-type="message"]').last();
await expect(lastPinnedMessage).toContainText('This message should be pinned and stared.');
await lastPinnedMessage.hover();
await lastPinnedMessage.locator('role=button[name="More"]').waitFor();
await lastPinnedMessage.locator('role=button[name="More"]').click();
await expect(page.locator('role=menuitem[name="Copy link"]')).toHaveClass(/disabled/);

await poHomeChannel.btnContextualbarClose.click();

await poHomeChannel.tabs.kebab.click();
await poHomeChannel.tabs.btnStarredMessageList.click();

const lastStarredMessage = page.getByRole('dialog', { name: 'Starred Messages' }).locator('[data-qa-type="message"]').last();
await expect(page.getByRole('dialog', { name: 'Starred Messages' })).toBeVisible();
await expect(page.getByRole('dialog', { name: 'Starred Messages' }).locator('[data-qa-type="message"]').last()).toContainText(
'This message should be pinned and stared.',
);
await expect(lastStarredMessage).toContainText('This message should be pinned and stared.');
await lastStarredMessage.hover();
await lastStarredMessage.locator('role=button[name="More"]').waitFor();
await lastStarredMessage.locator('role=button[name="More"]').click();
await expect(page.locator('role=menuitem[name="Copy link"]')).toHaveClass(/disabled/);
});

test.describe('reset keys', () => {
Expand Down

0 comments on commit f5ea2ff

Please sign in to comment.