2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fix 'reading' of an empty history.

This commit is contained in:
John Preston
2020-02-20 13:37:00 +04:00
parent 388173f0ad
commit a3f19c073b
2 changed files with 7 additions and 3 deletions

View File

@@ -131,6 +131,8 @@ void Histories::readInboxTill(
not_null<History*> history,
MsgId tillId,
bool force) {
Expects(IsServerMsgId(tillId) || (!tillId && !force));
if (!history->readInboxTillNeedsRequest(tillId) && !force) {
return;
} else if (!force) {
@@ -202,7 +204,9 @@ void Histories::sendReadRequests() {
const auto now = crl::now();
auto next = std::optional<crl::time>();
for (auto &[history, state] : _states) {
if (state.readTill && state.readWhen <= now) {
if (!state.readTill) {
continue;
} else if (state.readWhen <= now) {
sendReadRequest(history, state);
} else if (!next || *next > state.readWhen) {
next = state.readWhen;