From f2f19b14ebbd26b45fdeaf0489e967150a1b176c Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 17 Aug 2021 18:07:20 +0300 Subject: [PATCH] Fix reading one message if last one is outgoing. --- Telegram/SourceFiles/history/history.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 1c8820b270..c36a4677f2 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1631,7 +1631,16 @@ void History::setUnreadCount(int newUnreadCount) { const auto notifier = unreadStateChangeNotifier(true); _unreadCount = newUnreadCount; - if (newUnreadCount == 1) { + const auto lastOutgoing = [&] { + const auto last = lastMessage(); + return last + && IsServerMsgId(last->id) + && loadedAtBottom() + && !isEmpty() + && blocks.back()->messages.back()->data() == last + && last->out(); + }(); + if (newUnreadCount == 1 && !lastOutgoing) { if (loadedAtBottom()) { _firstUnreadView = !isEmpty() ? blocks.back()->messages.back().get()