Follow group->supergroup migration in info.

This commit is contained in:
John Preston 2017-11-06 16:14:44 +04:00
parent 11a3308cf5
commit 230c83d218
2 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "info/info_content_widget.h"
#include "info/info_memento.h"
#include "info/media/info_media_widget.h"
#include "observer_peer.h"
#include "window/window_controller.h"
namespace Info {
namespace {
@ -52,6 +54,29 @@ Controller::Controller(
, _window(window)
, _section(memento->section()) {
updateSearchControllers(memento);
setupMigrationViewer();
}
void Controller::setupMigrationViewer() {
if (!_peer->isChat() && (!_peer->isChannel() || _migrated != nullptr)) {
return;
}
Notify::PeerUpdateValue(_peer, Notify::PeerUpdate::Flag::MigrationChanged)
| rpl::start_with_next([this] {
if (_peer->migrateTo() || (_peer->migrateFrom() != _migrated)) {
auto windowController = window();
auto peerId = _peer->id;
auto section = _section;
InvokeQueued(_widget, [=] {
windowController->showSection(
Memento(peerId, section),
Window::SectionShow(
Window::SectionShow::Way::Backward,
anim::type::instant,
anim::activation::background));
});
}
}, lifetime());
}
Wrap Controller::wrap() const {

View File

@ -133,6 +133,7 @@ private:
void updateSearchControllers(not_null<ContentMemento*> memento);
SearchQuery produceSearchQuery(const QString &query) const;
void setupMigrationViewer();
not_null<WrapWidget*> _widget;
not_null<PeerData*> _peer;