From e46d5a86d34733d75860da1189afc46be24382a9 Mon Sep 17 00:00:00 2001 From: John Preston <johnprestonmail@gmail.com> Date: Tue, 28 Jan 2025 17:59:54 +0400 Subject: [PATCH] Don't auto-submit /start on non-loaded history. --- Telegram/SourceFiles/history/history_widget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 74f354e8a..b13600c9b 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4042,7 +4042,10 @@ void HistoryWidget::preloadHistoryIfNeeded() { preloadHistoryByScroll(); checkReplyReturns(); } - if (clearMaybeSendStart() && !_history->isDisplayedEmpty()) { + const auto hasNonEmpty = _history->findFirstNonEmpty(); + const auto readyForBotStart = hasNonEmpty + || (_history->loadedAtTop() && _history->loadedAtBottom()); + if (readyForBotStart && clearMaybeSendStart() && hasNonEmpty) { sendBotStartCommand(); } } @@ -8373,7 +8376,10 @@ void HistoryWidget::fullInfoUpdated() { handlePeerUpdate(); checkSuggestToGigagroup(); - if (clearMaybeSendStart() && !_history->isDisplayedEmpty()) { + const auto hasNonEmpty = _history->findFirstNonEmpty(); + const auto readyForBotStart = hasNonEmpty + || (_history->loadedAtTop() && _history->loadedAtBottom()); + if (readyForBotStart && clearMaybeSendStart() && hasNonEmpty) { sendBotStartCommand(); }