From d57dc41cee9ac829a681049120a52597dfaa6584 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Tue, 26 Jul 2022 10:40:21 +0530 Subject: [PATCH] fix: Do not reset the scroll if there is no new message (#5108) --- .../components/widgets/conversation/MessagesView.vue | 1 - .../dashboard/conversation/ConversationView.vue | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index 0b5aba1e2..50ca28b8f 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -87,7 +87,6 @@ :selected-tweet="selectedTweet" :popout-reply-box.sync="isPopoutReplyBox" @click="showPopoutReplyBox" - @scrollToMessage="scrollToBottom" /> diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue index 13515ac21..725e38db3 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue @@ -117,11 +117,16 @@ export default { }, setActiveChat() { if (this.conversationId) { - const chat = this.findConversation(); - if (!chat) { + const selectedConversation = this.findConversation(); + // If conversation doesn't exist or selected conversation is same as the active + // conversation, don't set active conversation. + if ( + !selectedConversation || + selectedConversation.id === this.currentChat.id + ) { return; } - this.$store.dispatch('setActiveChat', chat).then(() => { + this.$store.dispatch('setActiveChat', selectedConversation).then(() => { bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE); }); } else {