2
0
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:
John Preston
2022-10-04 19:34:45 +04:00
parent 065d2e2ac9
commit 3722e55b67
32 changed files with 447 additions and 130 deletions

View File

@@ -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();
}