Don't apply entry from dialogs if postponed.

This commit is contained in:
John Preston 2020-02-23 12:56:33 +04:00
parent f7144a55e2
commit a84c7e0b06
1 changed files with 7 additions and 5 deletions

View File

@ -297,6 +297,10 @@ void Histories::sendDialogRequests() {
} }
void Histories::dialogEntryApplied(not_null<History*> history) { void Histories::dialogEntryApplied(not_null<History*> history) {
const auto state = lookup(history);
if (state->postponedRequestEntry) {
return;
}
history->dialogEntryApplied(); history->dialogEntryApplied();
if (const auto callbacks = _dialogRequestsPending.take(history)) { if (const auto callbacks = _dialogRequestsPending.take(history)) {
for (const auto &callback : *callbacks) { for (const auto &callback : *callbacks) {
@ -308,13 +312,11 @@ void Histories::dialogEntryApplied(not_null<History*> history) {
callback(); callback();
} }
} }
if (const auto state = lookup(history)) { if (state && state->sentReadTill && state->sentReadDone) {
if (state->sentReadTill && state->sentReadDone) {
history->setInboxReadTill(base::take(state->sentReadTill)); history->setInboxReadTill(base::take(state->sentReadTill));
checkEmptyState(history); checkEmptyState(history);
} }
} }
}
void Histories::applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs) { void Histories::applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs) {
Expects(dialogs.type() == mtpc_messages_peerDialogs); Expects(dialogs.type() == mtpc_messages_peerDialogs);