From 4fe60fea76055745f9bd6926d9d09af667b43e87 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Tue, 5 Mar 2024 20:07:36 +0100 Subject: [PATCH] fix(messages): minor render enhancements - assign `viewId` on Options API initialising: chatIdentifier is no longer updated at `mounted()` - no cancelled requests - don't check system messages for parents: weird, but for federated conversations system conversations `getContext` at the moment response is processed, doesn't contain message parent - false check - system message is rendered as-is Signed-off-by: Maksim Sukharev --- src/components/MessagesList/MessagesList.vue | 3 +-- src/store/messagesStore.js | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 6693bf2d5476..7cbd42bba596 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -144,7 +144,7 @@ export default { */ messagesGroupedByDateByAuthor: {}, - viewId: null, + viewId: uniqueId('messagesList'), /** * When scrolling to the top of the div .scroller we start loading previous @@ -316,7 +316,6 @@ export default { this.debounceUpdateReadMarkerPosition = debounce(this.updateReadMarkerPosition, 1000) this.debounceHandleScroll = debounce(this.handleScroll, 50) - this.viewId = uniqueId('messagesList') this.scrollToBottom() EventBus.$on('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent) EventBus.$on('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom) diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js index 06c810a161f3..4af7b31bb3c7 100644 --- a/src/store/messagesStore.js +++ b/src/store/messagesStore.js @@ -529,15 +529,14 @@ const actions = { processMessage(context, { token, message }) { const sharedItemsStore = useSharedItemsStore() - if (message.parent && message.systemMessage - && (message.systemMessage === 'message_deleted' + if (message.systemMessage === 'message_deleted' || message.systemMessage === 'reaction' || message.systemMessage === 'reaction_deleted' || message.systemMessage === 'reaction_revoked' - || message.systemMessage === 'message_edited')) { + || message.systemMessage === 'message_edited') { // If parent message is presented in store and is different, we update it const parentInStore = context.getters.message(token, message.parent.id) - if (Object.keys(parentInStore).length !== 0 && JSON.stringify(parentInStore) !== JSON.stringify(message.parent)) { + if (Object.keys(parentInStore).length !== 0 && message.parent && JSON.stringify(parentInStore) !== JSON.stringify(message.parent)) { context.commit('addMessage', { token, message: message.parent }) }