mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 07:25:46 +00:00
Support topic on-the-fly creation.
This commit is contained in:
@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_forum_topic.h"
|
||||
#include "data/data_forum.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_download_manager.h"
|
||||
@@ -180,6 +181,7 @@ Controller::Controller(
|
||||
, _section(memento->section()) {
|
||||
updateSearchControllers(memento);
|
||||
setupMigrationViewer();
|
||||
setupTopicViewer();
|
||||
}
|
||||
|
||||
void Controller::setupMigrationViewer() {
|
||||
@@ -210,6 +212,17 @@ void Controller::setupMigrationViewer() {
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void Controller::setupTopicViewer() {
|
||||
session().data().itemIdChanged(
|
||||
) | rpl::start_with_next([=](const Data::Session::IdChange &change) {
|
||||
if (const auto topic = _key.topic()) {
|
||||
if (topic->rootId() == change.oldId) {
|
||||
_key = Key(topic->forum()->topicFor(change.newId.msg));
|
||||
}
|
||||
}
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
Wrap Controller::wrap() const {
|
||||
return _widget->wrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user