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

Close chat/media if thrown out by admin.

This commit is contained in:
John Preston
2024-04-18 10:45:06 +04:00
parent 4fb03e532c
commit a3b8397361
3 changed files with 23 additions and 3 deletions

View File

@@ -165,6 +165,7 @@ void ChannelData::setFlags(ChannelDataFlags which) {
const auto taken = ((diff & Flag::Forum) && !(which & Flag::Forum))
? mgInfo->takeForumData()
: nullptr;
const auto wasIn = amIn();
if ((diff & Flag::Forum) && (which & Flag::Forum)) {
mgInfo->ensureForum(this);
}
@@ -174,6 +175,14 @@ void ChannelData::setFlags(ChannelDataFlags which) {
session().changes().peerUpdated(chat, UpdateFlag::Migration);
session().changes().peerUpdated(this, UpdateFlag::Migration);
}
if (wasIn && !amIn()) {
crl::on_main(&session(), [=] {
if (!amIn()) {
Core::App().closeChatFromWindows(this);
}
});
}
}
if (diff & (Flag::Forum | Flag::CallNotEmpty | Flag::SimilarExpanded)) {
if (const auto history = this->owner().historyLoaded(this)) {