mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Handle migration to supergroups in boxes.
This commit is contained in:
@@ -139,8 +139,9 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
|
||||
| UpdateFlag::NameChanged
|
||||
| UpdateFlag::PhotoChanged
|
||||
| UpdateFlag::UserIsContact
|
||||
| UpdateFlag::UserOccupiedChanged;
|
||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(changes, [this](const Notify::PeerUpdate &update) {
|
||||
| UpdateFlag::UserOccupiedChanged
|
||||
| UpdateFlag::MigrationChanged;
|
||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(changes, [=](const Notify::PeerUpdate &update) {
|
||||
if (update.flags & UpdateFlag::ChatPinnedChanged) {
|
||||
stopReorderPinned();
|
||||
}
|
||||
@@ -156,6 +157,11 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
|
||||
userIsContactUpdated(user);
|
||||
}
|
||||
}
|
||||
if (update.flags & UpdateFlag::MigrationChanged) {
|
||||
if (const auto chat = update.peer->asChat()) {
|
||||
handleChatMigration(chat);
|
||||
}
|
||||
}
|
||||
}));
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::start_with_next([=](const Data::FeedUpdate &update) {
|
||||
@@ -175,6 +181,22 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
|
||||
setupShortcuts();
|
||||
}
|
||||
|
||||
void DialogsInner::handleChatMigration(not_null<ChatData*> chat) {
|
||||
const auto channel = chat->migrateTo();
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (const auto from = chat->owner().historyLoaded(chat)) {
|
||||
if (const auto to = chat->owner().historyLoaded(channel)) {
|
||||
if (to->inChatList(Dialogs::Mode::All)
|
||||
&& from->inChatList(Dialogs::Mode::All)) {
|
||||
removeDialog(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int DialogsInner::dialogsOffset() const {
|
||||
return _dialogsImportant ? st::dialogsImportantBarHeight : 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user