From 235c266d19fee594c80b675b2ab48d7953672976 Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Tue, 2 Jun 2026 19:09:28 -0300 Subject: [PATCH 1/5] fix: show non-member mention warning in threads --- .../Threads/hooks/useThreadMessagesQuery.ts | 18 ++++++++++++++++-- apps/meteor/tests/e2e/message-mentions.spec.ts | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts index 5966aa17cad4f..329c694350776 100644 --- a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts +++ b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts @@ -1,5 +1,5 @@ import { isThreadMessage, type IMessage, type IRoom, type IThreadMainMessage, type IThreadMessage } from '@rocket.chat/core-typings'; -import { useMethod, useStream } from '@rocket.chat/ui-contexts'; +import { useMethod, useStream, useUserId } from '@rocket.chat/ui-contexts'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useEffect, useRef } from 'react'; @@ -28,6 +28,8 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR const subscribeToRoomMessages = useStream('room-messages'); const subscribeToNotifyRoom = useStream('notify-room'); + const subscribeToNotifyUser = useStream('notify-user'); + const uid = useUserId(); const unprocessedReadMessagesEvent = useRef<{ tmid: string; until: Date } | null>(null); @@ -43,6 +45,17 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR upsertThreadMessageInCache(processed, roomId, tmid, queryClient); }); + const unsubscribeFromUserMessages = uid + ? subscribeToNotifyUser(`${uid}/message`, async (event) => { + if (event.rid !== roomId || event.tmid !== tmid || event._hidden === true) { + return; + } + + const processed = await onClientMessageReceived(event); + upsertThreadMessageInCache(processed, roomId, tmid, queryClient); + }) + : () => undefined; + const unsubscribeFromDeleteMessage = subscribeToNotifyRoom(`${roomId}/deleteMessage`, (event) => { queryClient.setQueryData(currentQueryKey, (old) => { if (!old) { @@ -94,11 +107,12 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR return () => { unsubscribeFromRoomMessages(); + unsubscribeFromUserMessages(); unsubscribeFromDeleteMessage(); unsubscribeFromDeleteMessageBulk(); unsubscribeFromMessagesRead(); }; - }, [tmid, roomId, queryClient, subscribeToRoomMessages, subscribeToNotifyRoom]); + }, [tmid, roomId, queryClient, subscribeToRoomMessages, subscribeToNotifyRoom, subscribeToNotifyUser, uid]); return useQuery({ queryKey, diff --git a/apps/meteor/tests/e2e/message-mentions.spec.ts b/apps/meteor/tests/e2e/message-mentions.spec.ts index d03c62edd4f5b..7558a39ea91a1 100644 --- a/apps/meteor/tests/e2e/message-mentions.spec.ts +++ b/apps/meteor/tests/e2e/message-mentions.spec.ts @@ -169,6 +169,23 @@ test.describe.serial('message-mentions', () => { }); }); + test('should show non-member mention warning inside threads', async ({ page }) => { + const adminPage = new HomeChannel(page); + const mentionText = getMentionText(Users.user2.data.username, 1); + + await test.step('open thread', async () => { + await adminPage.navbar.openChat(targetChannel); + await adminPage.content.sendMessage('thread parent for non-member mention warning'); + await adminPage.content.openReplyInThread(); + await adminPage.content.waitForThread(); + }); + + await test.step('receive bot message inside thread', async () => { + await adminPage.content.sendMessageInThread(getMentionText(Users.user2.data.username)); + await expect(adminPage.content.threadMessageListItems.filter({ hasText: mentionText }).first()).toBeVisible(); + }); + }); + test.describe(() => { test.use({ storageState: Users.user1.state }); From e187be9d5691984219746130192d4f750e1b8e3d Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Tue, 2 Jun 2026 19:35:57 -0300 Subject: [PATCH 2/5] test: message action button visibility --- .../meteor/tests/e2e/message-mentions.spec.ts | 48 +++++++++++-------- .../page-objects/fragments/home-content.ts | 4 ++ 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/apps/meteor/tests/e2e/message-mentions.spec.ts b/apps/meteor/tests/e2e/message-mentions.spec.ts index 7558a39ea91a1..d30286c47c8f4 100644 --- a/apps/meteor/tests/e2e/message-mentions.spec.ts +++ b/apps/meteor/tests/e2e/message-mentions.spec.ts @@ -137,17 +137,17 @@ test.describe.serial('message-mentions', () => { }); await test.step('show "Do nothing" action', async () => { - await expect(adminPage.content.lastUserMessage.locator('button >> text="Do nothing"')).toBeVisible(); + await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); }); await test.step('show "Add them" action', async () => { - await expect(adminPage.content.lastUserMessage.locator('button >> text="Add them"')).toBeVisible(); + await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Add them')).toBeVisible(); }); await test.step('show "Let them know" action', async () => { - await expect(adminPage.content.lastUserMessage.locator('button >> text="Let them know"')).toBeVisible(); + await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Let them know')).toBeVisible(); }); await test.step('dismiss', async () => { - await adminPage.content.lastUserMessage.locator('button >> text="Do nothing"').click(); + await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -155,7 +155,7 @@ test.describe.serial('message-mentions', () => { await expect(adminPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('send message to users', async () => { - await adminPage.content.lastUserMessage.locator('button >> text="Let them know"').click(); + await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Let them know').click(); await expect(adminPage.content.lastUserMessageBody).toContainText(getMentionText(Users.user1.data.username, 3)); }); @@ -164,7 +164,7 @@ test.describe.serial('message-mentions', () => { await expect(adminPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('add users to room', async () => { - await adminPage.content.lastUserMessage.locator('button >> text="Add them"').click(); + await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Add them').click(); await expect(adminPage.content.lastSystemMessageBody).toContainText('added'); }); }); @@ -182,7 +182,15 @@ test.describe.serial('message-mentions', () => { await test.step('receive bot message inside thread', async () => { await adminPage.content.sendMessageInThread(getMentionText(Users.user2.data.username)); - await expect(adminPage.content.threadMessageListItems.filter({ hasText: mentionText }).first()).toBeVisible(); + await expect(adminPage.content.lastUserThreadMessage).toContainText(mentionText); + }); + + await test.step('show actions inside thread', async () => { + const botMessage = adminPage.content.lastUserThreadMessage; + + await expect(adminPage.content.getMessageActionButton(botMessage, 'Do nothing')).toBeVisible(); + await expect(adminPage.content.getMessageActionButton(botMessage, 'Add them')).toBeVisible(); + await expect(adminPage.content.getMessageActionButton(botMessage, 'Let them know')).toBeVisible(); }); }); @@ -200,17 +208,17 @@ test.describe.serial('message-mentions', () => { }); await test.step('show "Do nothing" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Do nothing"')).toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); }); await test.step('show "Let them know" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Let them know"')).toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).toBeVisible(); }); await test.step('not show "Add them action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Add them"')).not.toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).not.toBeVisible(); }); await test.step('dismiss', async () => { - await userPage.content.lastUserMessage.locator('button >> text="Do nothing"').click(); + await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -219,7 +227,7 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('send message to users', async () => { - await userPage.content.lastUserMessage.locator('button >> text="Let them know"').click(); + await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know').click(); await expect(userPage.content.lastUserMessageBody).toContainText(getMentionText(Users.user2.data.username, 3)); }); }); @@ -254,17 +262,17 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('show "Do nothing" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Do nothing"')).toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); }); await test.step('show "Add them" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Add them"')).toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).toBeVisible(); }); await test.step('not show "Let them know" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Let them know"')).not.toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).not.toBeVisible(); }); await test.step('dismiss', async () => { - await userPage.content.lastUserMessage.locator('button >> text="Do nothing"').click(); + await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -273,7 +281,7 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('add users to room', async () => { - await userPage.content.lastUserMessage.locator('button >> text="Add them"').click(); + await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them').click(); await expect(userPage.content.lastSystemMessageBody).toContainText('added'); }); }); @@ -302,13 +310,13 @@ test.describe.serial('message-mentions', () => { }); await test.step('not show "Do nothing" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Do nothing"')).not.toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).not.toBeVisible(); }); await test.step('not show "Add them" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Add them"')).not.toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).not.toBeVisible(); }); await test.step('not show "Let them know" action', async () => { - await expect(userPage.content.lastUserMessage.locator('button >> text="Let them know"')).not.toBeVisible(); + await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).not.toBeVisible(); }); }); }); diff --git a/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts b/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts index 4feef449186aa..2614e2d9850dd 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts @@ -544,6 +544,10 @@ export class HomeContent { return this.page.locator('[role="listitem"][aria-roledescription="message"]', { hasText: text }); } + getMessageActionButton(message: Locator, name: string): Locator { + return message.getByRole('button', { name, exact: true }); + } + getMessageById(id: string): Locator { return this.page.locator(`[role="listitem"][aria-roledescription="message"][id="${id}"]`); } From 934b7c4b0870ea6202fd3e8f5358bc1da61147c1 Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Tue, 2 Jun 2026 19:51:43 -0300 Subject: [PATCH 3/5] test: button methods for consistency in tests --- .../meteor/tests/e2e/message-mentions.spec.ts | 46 +++++++++---------- .../page-objects/fragments/home-content.ts | 8 +++- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/apps/meteor/tests/e2e/message-mentions.spec.ts b/apps/meteor/tests/e2e/message-mentions.spec.ts index d30286c47c8f4..17ea83daa44a8 100644 --- a/apps/meteor/tests/e2e/message-mentions.spec.ts +++ b/apps/meteor/tests/e2e/message-mentions.spec.ts @@ -137,17 +137,17 @@ test.describe.serial('message-mentions', () => { }); await test.step('show "Do nothing" action', async () => { - await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); + await expect(adminPage.content.getLastMessageActionButton('Do nothing')).toBeVisible(); }); await test.step('show "Add them" action', async () => { - await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Add them')).toBeVisible(); + await expect(adminPage.content.getLastMessageActionButton('Add them')).toBeVisible(); }); await test.step('show "Let them know" action', async () => { - await expect(adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Let them know')).toBeVisible(); + await expect(adminPage.content.getLastMessageActionButton('Let them know')).toBeVisible(); }); await test.step('dismiss', async () => { - await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Do nothing').click(); + await adminPage.content.getLastMessageActionButton('Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -155,7 +155,7 @@ test.describe.serial('message-mentions', () => { await expect(adminPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('send message to users', async () => { - await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Let them know').click(); + await adminPage.content.getLastMessageActionButton('Let them know').click(); await expect(adminPage.content.lastUserMessageBody).toContainText(getMentionText(Users.user1.data.username, 3)); }); @@ -164,7 +164,7 @@ test.describe.serial('message-mentions', () => { await expect(adminPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('add users to room', async () => { - await adminPage.content.getMessageActionButton(adminPage.content.lastUserMessage, 'Add them').click(); + await adminPage.content.getLastMessageActionButton('Add them').click(); await expect(adminPage.content.lastSystemMessageBody).toContainText('added'); }); }); @@ -186,11 +186,9 @@ test.describe.serial('message-mentions', () => { }); await test.step('show actions inside thread', async () => { - const botMessage = adminPage.content.lastUserThreadMessage; - - await expect(adminPage.content.getMessageActionButton(botMessage, 'Do nothing')).toBeVisible(); - await expect(adminPage.content.getMessageActionButton(botMessage, 'Add them')).toBeVisible(); - await expect(adminPage.content.getMessageActionButton(botMessage, 'Let them know')).toBeVisible(); + await expect(adminPage.content.getLastThreadMessageActionButton('Do nothing')).toBeVisible(); + await expect(adminPage.content.getLastThreadMessageActionButton('Add them')).toBeVisible(); + await expect(adminPage.content.getLastThreadMessageActionButton('Let them know')).toBeVisible(); }); }); @@ -208,17 +206,17 @@ test.describe.serial('message-mentions', () => { }); await test.step('show "Do nothing" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Do nothing')).toBeVisible(); }); await test.step('show "Let them know" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Let them know')).toBeVisible(); }); await test.step('not show "Add them action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).not.toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Add them')).not.toBeVisible(); }); await test.step('dismiss', async () => { - await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing').click(); + await userPage.content.getLastMessageActionButton('Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -227,7 +225,7 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('send message to users', async () => { - await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know').click(); + await userPage.content.getLastMessageActionButton('Let them know').click(); await expect(userPage.content.lastUserMessageBody).toContainText(getMentionText(Users.user2.data.username, 3)); }); }); @@ -262,17 +260,17 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('show "Do nothing" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Do nothing')).toBeVisible(); }); await test.step('show "Add them" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Add them')).toBeVisible(); }); await test.step('not show "Let them know" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).not.toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Let them know')).not.toBeVisible(); }); await test.step('dismiss', async () => { - await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing').click(); + await userPage.content.getLastMessageActionButton('Do nothing').click(); }); await test.step('receive second bot message', async () => { @@ -281,7 +279,7 @@ test.describe.serial('message-mentions', () => { await expect(userPage.content.lastUserMessage.locator('.rcx-message-block')).toContainText(mentionText); }); await test.step('add users to room', async () => { - await userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them').click(); + await userPage.content.getLastMessageActionButton('Add them').click(); await expect(userPage.content.lastSystemMessageBody).toContainText('added'); }); }); @@ -310,13 +308,13 @@ test.describe.serial('message-mentions', () => { }); await test.step('not show "Do nothing" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Do nothing')).not.toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Do nothing')).not.toBeVisible(); }); await test.step('not show "Add them" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Add them')).not.toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Add them')).not.toBeVisible(); }); await test.step('not show "Let them know" action', async () => { - await expect(userPage.content.getMessageActionButton(userPage.content.lastUserMessage, 'Let them know')).not.toBeVisible(); + await expect(userPage.content.getLastMessageActionButton('Let them know')).not.toBeVisible(); }); }); }); diff --git a/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts b/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts index 2614e2d9850dd..a17e56af0e652 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/home-content.ts @@ -544,8 +544,12 @@ export class HomeContent { return this.page.locator('[role="listitem"][aria-roledescription="message"]', { hasText: text }); } - getMessageActionButton(message: Locator, name: string): Locator { - return message.getByRole('button', { name, exact: true }); + getLastMessageActionButton(name: string): Locator { + return this.lastUserMessage.getByRole('button', { name, exact: true }); + } + + getLastThreadMessageActionButton(name: string): Locator { + return this.lastUserThreadMessage.getByRole('button', { name, exact: true }); } getMessageById(id: string): Locator { From 0ce055dc646df50d0138080ecfa0f9e276f6ef43 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Wed, 3 Jun 2026 14:43:18 -0300 Subject: [PATCH 4/5] revert: useThreadMessagesQuery --- .../Threads/hooks/useThreadMessagesQuery.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts index 329c694350776..5966aa17cad4f 100644 --- a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts +++ b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMessagesQuery.ts @@ -1,5 +1,5 @@ import { isThreadMessage, type IMessage, type IRoom, type IThreadMainMessage, type IThreadMessage } from '@rocket.chat/core-typings'; -import { useMethod, useStream, useUserId } from '@rocket.chat/ui-contexts'; +import { useMethod, useStream } from '@rocket.chat/ui-contexts'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useEffect, useRef } from 'react'; @@ -28,8 +28,6 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR const subscribeToRoomMessages = useStream('room-messages'); const subscribeToNotifyRoom = useStream('notify-room'); - const subscribeToNotifyUser = useStream('notify-user'); - const uid = useUserId(); const unprocessedReadMessagesEvent = useRef<{ tmid: string; until: Date } | null>(null); @@ -45,17 +43,6 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR upsertThreadMessageInCache(processed, roomId, tmid, queryClient); }); - const unsubscribeFromUserMessages = uid - ? subscribeToNotifyUser(`${uid}/message`, async (event) => { - if (event.rid !== roomId || event.tmid !== tmid || event._hidden === true) { - return; - } - - const processed = await onClientMessageReceived(event); - upsertThreadMessageInCache(processed, roomId, tmid, queryClient); - }) - : () => undefined; - const unsubscribeFromDeleteMessage = subscribeToNotifyRoom(`${roomId}/deleteMessage`, (event) => { queryClient.setQueryData(currentQueryKey, (old) => { if (!old) { @@ -107,12 +94,11 @@ export const useThreadMessagesQuery = (tmid: IThreadMainMessage['_id'], rid?: IR return () => { unsubscribeFromRoomMessages(); - unsubscribeFromUserMessages(); unsubscribeFromDeleteMessage(); unsubscribeFromDeleteMessageBulk(); unsubscribeFromMessagesRead(); }; - }, [tmid, roomId, queryClient, subscribeToRoomMessages, subscribeToNotifyRoom, subscribeToNotifyUser, uid]); + }, [tmid, roomId, queryClient, subscribeToRoomMessages, subscribeToNotifyRoom]); return useQuery({ queryKey, From 7b712751afcf453f458dfd770917df6bdb50d9ce Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Wed, 3 Jun 2026 14:58:51 -0300 Subject: [PATCH 5/5] update thread messages on incomingMessages --- apps/meteor/client/startup/incomingMessages.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/meteor/client/startup/incomingMessages.ts b/apps/meteor/client/startup/incomingMessages.ts index 4efd3dba0fbf7..eafdb5e1838d3 100644 --- a/apps/meteor/client/startup/incomingMessages.ts +++ b/apps/meteor/client/startup/incomingMessages.ts @@ -3,6 +3,7 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { sdk } from '../../app/utils/client/lib/SDKClient'; import { onLoggedIn } from '../lib/loggedIn'; import { getUserId } from '../lib/user'; +import { upsertThreadMessageInCache } from '../lib/utils/threadMessageUtils'; import { Messages } from '../stores'; onLoggedIn(() => { @@ -12,6 +13,10 @@ onLoggedIn(() => { msg.u = msg.u || { username: 'rocket.cat' }; msg.private = true; + if (msg.tmid) { + upsertThreadMessageInCache(msg, msg.rid, msg.tmid); + } + return Messages.state.store(msg); }).stop; });