2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Fix leaving channels and supergroups.

Fixes #5838.
This commit is contained in:
John Preston
2019-03-25 15:49:57 +04:00
parent d7a67a6a1c
commit bb2e683dea
3 changed files with 23 additions and 16 deletions

View File

@@ -2363,21 +2363,6 @@ void ApiWrap::clearHistory(not_null<PeerData*> peer, bool revoke) {
}
void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
if (const auto history = _session->data().historyLoaded(peer->id)) {
_session->data().setPinnedDialog(history, false);
App::main()->removeDialog(history);
history->clear();
if (const auto channel = peer->asMegagroup()) {
channel->addFlags(MTPDchannel::Flag::f_left);
if (const auto from = channel->getMigrateFromChat()) {
if (const auto migrated = _session->data().historyLoaded(from)) {
migrated->updateChatListExistence();
}
}
} else {
history->markFullyLoaded();
}
}
if (const auto chat = peer->asChat()) {
request(MTPmessages_DeleteChatUser(
chat->inputChat,
@@ -2388,13 +2373,13 @@ void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
}).fail([=](const RPCError &error) {
deleteHistory(peer, false, revoke);
}).send();
return;
} else if (const auto channel = peer->asChannel()) {
channel->ptsWaitingForShortPoll(-1);
leaveChannel(channel);
} else {
deleteHistory(peer, false, revoke);
}
_session->data().deleteConversationLocally(peer);
}
void ApiWrap::deleteHistory(not_null<PeerData*> peer, bool justClear, bool revoke) {