2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +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

@@ -39,6 +39,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document_resolver.h"
#include "data/data_changes.h"
#include "data/data_group_call.h"
#include "data/data_forum.h"
#include "data/data_forum_topic.h"
#include "data/data_chat_filters.h"
#include "data/data_peer_values.h"
#include "passport/passport_form_controller.h"
@@ -674,6 +676,27 @@ SessionController::SessionController(
});
}, lifetime());
session->data().itemIdChanged(
) | rpl::start_with_next([=](Data::Session::IdChange change) {
const auto current = _activeChatEntry.current();
if (const auto topic = current.key.topic()) {
if (topic->rootId() == change.oldId) {
setActiveChatEntry({
Dialogs::Key(topic->forum()->topicFor(change.newId.msg)),
current.fullId,
});
}
}
for (auto &entry : _chatEntryHistory) {
if (const auto topic = entry.key.topic()) {
if (topic->rootId() == change.oldId) {
entry.key = Dialogs::Key(
topic->forum()->topicFor(change.newId.msg));
}
}
}
}, lifetime());
session->api().globalPrivacy().suggestArchiveAndMute(
) | rpl::take(1) | rpl::start_with_next([=] {
session->api().globalPrivacy().reload(crl::guard(this, [=] {