From 401895c9327444f291821d08746d13299db3a918 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 25 Feb 2023 18:50:21 +0100 Subject: [PATCH] Reactions: Fix repeated effect playback if paused before ending (#2657) --- src/global/actions/api/reactions.ts | 12 ------------ src/global/actions/ui/chats.ts | 15 +++++++++------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/global/actions/api/reactions.ts b/src/global/actions/api/reactions.ts index 170d98037..04124c836 100644 --- a/src/global/actions/api/reactions.ts +++ b/src/global/actions/api/reactions.ts @@ -8,7 +8,6 @@ import { selectDefaultReaction, selectMaxUserReactions, selectMessageIdsByGroupId, - selectCurrentMessageList, } from '../../selectors'; import { addMessageReaction, subtractXForEmojiInteraction, updateUnreadReactions } from '../../reducers/reactions'; import { @@ -159,17 +158,6 @@ addActionHandler('toggleReaction', (global, actions, payload): ActionReturnType return addMessageReaction(global, message, reactions); }); -addActionHandler('openChat', (global, actions, payload): ActionReturnType => { - const { id, tabId = getCurrentTabId() } = payload; - const currentChatId = selectCurrentMessageList(global, tabId)?.chatId; - - if (currentChatId === id) return global; - - return updateTabState(global, { - activeReactions: {}, - }, tabId); -}); - addActionHandler('stopActiveReaction', (global, actions, payload): ActionReturnType => { const { messageId, reaction, tabId = getCurrentTabId() } = payload; diff --git a/src/global/actions/ui/chats.ts b/src/global/actions/ui/chats.ts index 63e85a59a..3fe3b7526 100644 --- a/src/global/actions/ui/chats.ts +++ b/src/global/actions/ui/chats.ts @@ -34,14 +34,17 @@ addActionHandler('openChat', (global, actions, payload): ActionReturnType => { }, tabId); } - if (!currentMessageList - || ( - currentMessageList.chatId !== id - || currentMessageList.threadId !== threadId - || currentMessageList.type !== type - )) { + if (!currentMessageList || ( + currentMessageList.chatId !== id + || currentMessageList.threadId !== threadId + || currentMessageList.type !== type + )) { if (id) { global = replaceTabThreadParam(global, id, threadId, 'replyStack', [], tabId); + + global = updateTabState(global, { + activeReactions: {}, + }, tabId); } global = exitMessageSelectMode(global, tabId);