2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-10-11 13:47:24 +00:00

Save last opened subsection within a launch.

This commit is contained in:
John Preston
2025-06-05 12:47:16 +04:00
parent 4b25406d14
commit 3bc20c3550
11 changed files with 103 additions and 8 deletions

View File

@@ -189,6 +189,9 @@ void Forum::applyTopicDeleted(MsgId rootId) {
reorderLastTopics();
}
if (_activeSubsectionTopic == raw) {
_activeSubsectionTopic = nullptr;
}
_topicDestroyed.fire(raw);
session().changes().topicUpdated(
raw,
@@ -259,6 +262,20 @@ const std::vector<not_null<ForumTopic*>> &Forum::recentTopics() const {
return _lastTopics;
}
void Forum::saveActiveSubsectionThread(not_null<Thread*> thread) {
if (const auto topic = thread->asTopic()) {
Assert(topic->forum() == this);
_activeSubsectionTopic = topic->creating() ? nullptr : topic;
} else {
Assert(thread == history());
_activeSubsectionTopic = nullptr;
}
}
Thread *Forum::activeSubsectionThread() const {
return _activeSubsectionTopic;
}
void Forum::listMessageChanged(HistoryItem *from, HistoryItem *to) {
if (from || to) {
reorderLastTopics();