mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Fix leaving forum glitch.
This commit is contained in:
parent
bfbdf1b935
commit
eec59611ef
1 changed files with 17 additions and 10 deletions
|
@ -1271,24 +1271,31 @@ History *Session::historyLoaded(const PeerData *peer) {
|
|||
}
|
||||
|
||||
void Session::deleteConversationLocally(not_null<PeerData*> peer) {
|
||||
const auto history = historyLoaded(peer);
|
||||
if (history) {
|
||||
const auto markLeft = [&] {
|
||||
if (const auto channel = peer->asMegagroup()) {
|
||||
channel->addFlags(ChannelDataFlag::Left);
|
||||
if (const auto from = channel->getMigrateFromChat()) {
|
||||
if (const auto migrated = historyLoaded(from)) {
|
||||
migrated->updateChatListExistence();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (const auto history = historyLoaded(peer)) {
|
||||
if (history->folderKnown()) {
|
||||
setChatPinned(history, FilterId(), false);
|
||||
}
|
||||
removeChatListEntry(history);
|
||||
history->clearFolder();
|
||||
|
||||
// We want to mark the channel as left before unloading the history,
|
||||
// otherwise some parts of updating may return us to the chats list.
|
||||
markLeft();
|
||||
history->clear(peer->isChannel()
|
||||
? History::ClearType::Unload
|
||||
: History::ClearType::DeleteChat);
|
||||
}
|
||||
if (const auto channel = peer->asMegagroup()) {
|
||||
channel->addFlags(ChannelDataFlag::Left);
|
||||
if (const auto from = channel->getMigrateFromChat()) {
|
||||
if (const auto migrated = historyLoaded(from)) {
|
||||
migrated->updateChatListExistence();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
markLeft();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue