diff options
author | Maksim Sukharev <antreesy.web@gmail.com> | 2024-07-02 19:52:53 +0200 |
---|---|---|
committer | Maksim Sukharev <antreesy.web@gmail.com> | 2024-07-02 19:52:53 +0200 |
commit | 1d76f7852ed0e525e308d388116a7c52d4ab1c2d (patch) | |
tree | 3c08877ee96f207b84e6cf316164029e1b7cf251 | |
parent | a3c275cacab1b70b949895fefbdc4876fd2afc04 (diff) |
fix(chat): update deleted messages in LeftSidebar
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
-rw-r--r-- | src/store/messagesStore.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js index 7895a2cea..c6066cce9 100644 --- a/src/store/messagesStore.js +++ b/src/store/messagesStore.js @@ -541,15 +541,6 @@ const actions = { context.commit('addMessage', { token, message: message.parent }) } - // update conversation lastMessage, if it was edited - if (message.systemMessage === 'message_edited' - && message.parent.id === context.getters.conversation(token).lastMessage.id) { - context.dispatch('updateConversationLastMessage', { - token, - lastMessage: message.parent, - }) - } - const reactionsStore = useReactionsStore() if (message.systemMessage === 'message_deleted') { reactionsStore.resetReactions(token, message.parent.id) @@ -558,6 +549,10 @@ const actions = { } if (message.systemMessage === 'message_edited' || message.systemMessage === 'message_deleted') { + // update conversation lastMessage, if it was edited or deleted + if (message.parent.id === context.getters.conversation(token).lastMessage.id) { + context.dispatch('updateConversationLastMessage', { token, lastMessage: message.parent }) + } // Check existing messages for having a deleted / edited message as parent, and update them context.getters.messagesList(token) .filter(storedMessage => storedMessage.parent?.id === message.parent.id && JSON.stringify(storedMessage.parent) !== JSON.stringify(message.parent)) |