From 2d2cc73589aec0c9e7025471673183cd7b7e99d3 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 20 Sep 2022 14:59:14 +0200 Subject: [PATCH] Message List: Fix scroll down when new message is sent from other client (#2045) --- src/global/actions/apiUpdaters/messages.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/global/actions/apiUpdaters/messages.ts b/src/global/actions/apiUpdaters/messages.ts index 6fe93c900..5e1312d9d 100644 --- a/src/global/actions/apiUpdaters/messages.ts +++ b/src/global/actions/apiUpdaters/messages.ts @@ -75,8 +75,9 @@ addActionHandler('apiUpdate', (global, actions, update) => { const newMessage = selectChatMessage(global, chatId, id)!; + const isLocal = isMessageLocal(message as ApiMessage); if (selectIsMessageInCurrentMessageList(global, chatId, message as ApiMessage)) { - if (message.isOutgoing && !(message.content?.action)) { + if (isLocal && message.isOutgoing && !(message.content?.action)) { const currentMessageList = selectCurrentMessageList(global); if (currentMessageList) { // We do not use `actions.focusLastMessage` as it may be set with a delay (see below) @@ -96,7 +97,7 @@ addActionHandler('apiUpdate', (global, actions, update) => { } // @perf Wait until scroll animation finishes or simply rely on delivery status update (which is itself delayed) - if (!isMessageLocal(message as ApiMessage)) { + if (!isLocal) { setTimeout(() => { let delayedGlobal = getGlobal(); if (shouldForceReply) {