From 9075489c18463931cebd09355b097cd6687bc705 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 15 Oct 2021 18:15:50 +0400 Subject: [PATCH] Use last history item date for jump-to-date. --- Telegram/SourceFiles/window/window_session_controller.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 094e68c80..8f69fb0e9 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1156,8 +1156,8 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) { return history->blocks.front()->messages.front()->dateTime().date(); } } - } else if (history->chatListTimeId() != 0) { - return base::unixtime::parse(history->chatListTimeId()).date(); + } else if (const auto item = history->lastMessage()) { + return base::unixtime::parse(item->date()).date(); } } return QDate(); @@ -1167,8 +1167,8 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) { if (const auto channel = history->peer->migrateTo()) { history = channel->owner().historyLoaded(channel); } - if (history && history->chatListTimeId() != 0) { - return base::unixtime::parse(history->chatListTimeId()).date(); + if (const auto item = history ? history->lastMessage() : nullptr) { + return base::unixtime::parse(item->date()).date(); } } return QDate::currentDate();