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

fix: Read receipts menu item enabled condition (#31695)

parent b01cdcef
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': patch
---
Fix an issue where read receipts menu item wasn't considering the enabled setting to be displayed
......@@ -9,7 +9,7 @@ import ReadReceiptsModal from '../../../client/views/room/modals/ReadReceiptsMod
Meteor.startup(() => {
Tracker.autorun(() => {
const enabled = settings.get('Message_Read_Receipt_Store_Users');
const enabled = settings.get('Message_Read_Receipt_Enabled') && settings.get('Message_Read_Receipt_Store_Users');
if (!enabled) {
return MessageAction.removeButton('receipt-detail');
......
......@@ -14,9 +14,6 @@ test.describe.serial('read-receipts', () => {
test.skip(!IS_EE, 'Enterprise Only');
test.beforeAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', true);
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', true);
targetChannel = await createTargetChannel(api);
});
......@@ -26,26 +23,47 @@ test.describe.serial('read-receipts', () => {
await page.goto('/home');
});
test('should show read receipts message sent status in the sent message', async ({ browser }) => {
const { page } = await createAuxContext(browser, Users.user1);
const auxContext = { page, poHomeChannel: new HomeChannel(page) };
await auxContext.poHomeChannel.sidenav.openChat(targetChannel);
await auxContext.poHomeChannel.content.sendMessage('hello admin');
await expect(auxContext.poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible();
await auxContext.page.close();
test.describe('read receipt settings disabled', async () => {
test('should not show read receipts item menu', async ({ page }) => {
await poHomeChannel.sidenav.openChat(targetChannel);
await poHomeChannel.content.sendMessage('hello world');
await poHomeChannel.content.openLastMessageMenu();
expect(page.locator('role=menuitem[name="Read receipts"]')).not.toBeVisible;
});
});
test('should show read receipts message viewed status in the sent message', async () => {
await poHomeChannel.sidenav.openChat(targetChannel);
await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible();
});
test.describe('read receipts enabled', async () => {
test.beforeAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', true);
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', true);
});
test('should show the reads receipt modal with the users who read the message', async ({ page }) => {
await poHomeChannel.sidenav.openChat(targetChannel);
await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Read receipts"]').click();
test.afterAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', false);
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', false);
});
await expect(page.getByRole('dialog').getByRole('listitem')).toHaveCount(2);
test('should show read receipts message sent status in the sent message', async ({ browser }) => {
const { page } = await createAuxContext(browser, Users.user1);
const auxContext = { page, poHomeChannel: new HomeChannel(page) };
await auxContext.poHomeChannel.sidenav.openChat(targetChannel);
await auxContext.poHomeChannel.content.sendMessage('hello admin');
await expect(auxContext.poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible();
await auxContext.page.close();
});
test('should show read receipts message viewed status in the sent message', async () => {
await poHomeChannel.sidenav.openChat(targetChannel);
await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible();
});
test('should show the reads receipt modal with the users who read the message', async ({ page }) => {
await poHomeChannel.sidenav.openChat(targetChannel);
await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Read receipts"]').click();
await expect(page.getByRole('dialog').getByRole('listitem')).toHaveCount(2);
});
});
});
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