Use last history item date for jump-to-date.

This commit is contained in:
John Preston 2021-10-15 18:15:50 +04:00
parent d361f5c6b0
commit 9075489c18

View File

@ -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();