From aa8eff5e16c45f77a81e83c2a24fae205cd757ae Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 17 Mar 2023 22:46:59 +0100 Subject: [PATCH] FIX: ensures updateLastRead is called when receiving a message (#20728) This behavior is hard to test as it's mostly fixing a race condition: User A sends a message at the same time than User B, which as a result doesn't cause a scroll for the second message and we don't update last read unless we do a small up and down scroll. `updateLastRead` is debounced so it has no direct consequences to call it slightly more often than what should ideally be needed. --- .../assets/javascripts/discourse/components/chat-live-pane.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js index 42044b58923..09f9210cd5c 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js @@ -613,6 +613,7 @@ export default class ChatLivePane extends Component { const message = ChatMessage.create(this.args.channel, data.chat_message); this.args.channel.addMessages([message]); this.scrollToLatestMessage(); + this.updateLastReadMessage(); } else { // If we are almost at the bottom, we append the message and notice the user const message = ChatMessage.create(this.args.channel, data.chat_message);