From 8bf560090c29c4ef232967abc42923c4f2496dbf Mon Sep 17 00:00:00 2001 From: Reed <3893871+dharit-tan@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:32:24 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"[PAY-3593]=20Revert=20"[PAY-3592]=20A?= =?UTF-8?q?lways=20mark=20chat=20as=20read=20(temp=20=E2=80=A6=20(#11075)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/src/store/pages/chat/sagas.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/common/src/store/pages/chat/sagas.ts b/packages/common/src/store/pages/chat/sagas.ts index b3a731ac743..3df0e14219f 100644 --- a/packages/common/src/store/pages/chat/sagas.ts +++ b/packages/common/src/store/pages/chat/sagas.ts @@ -547,21 +547,10 @@ function* doMarkChatAsRead(action: ReturnType) { // Use non-optimistic chat here so that the calculation of whether to mark // the chat as read or not are consistent with values in backend const chat = yield* select((state) => getNonOptimisticChat(state, chatId)) - if (chat?.is_blast) { - return - } - if ( - !chat || - !chat?.last_read_at || - dayjs(chat?.last_read_at).isBefore(chat?.last_message_at) - ) { - yield* call([sdk.chats, sdk.chats.read], { chatId }) - yield* put(markChatAsReadSucceeded({ chatId })) - } else { - // Mark the write as 'failed' in this case (just means we already marked this as read somehow) - // to delete the optimistic read status - yield* put(markChatAsReadFailed({ chatId })) - } + if (chat?.is_blast) return + + yield* call([sdk.chats, sdk.chats.read], { chatId }) + yield* put(markChatAsReadSucceeded({ chatId })) } catch (e) { yield* put(markChatAsReadFailed({ chatId })) const reportToSentry = yield* getContext('reportToSentry')