diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 3d1c5b185..cec2ec60f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -2999,7 +2999,14 @@ void ApiWrap::sharedMediaDone( void ApiWrap::sendAction(const SendAction &action) { if (!action.options.scheduled) { - _session->data().histories().readInbox(action.history); + const auto topic = action.topicRootId + ? action.history->peer->forumTopicFor(action.topicRootId) + : nullptr; + if (topic) { + topic->readTillEnd(); + } else { + _session->data().histories().readInbox(action.history); + } action.history->getReadyFor(ShowAtTheEndMsgId); } _sendActions.fire_copy(action); diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index 2416f10ce..99910b7fb 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -254,6 +254,10 @@ void ForumTopic::setRealRootId(MsgId realId) { } } +void ForumTopic::readTillEnd() { + _replies->readTill(_lastKnownServerMessageId); +} + void ForumTopic::applyTopic(const MTPDforumTopic &data) { Expects(_rootId == data.vid().v); diff --git a/Telegram/SourceFiles/data/data_forum_topic.h b/Telegram/SourceFiles/data/data_forum_topic.h index 7e3d9e4e5..bca37c76b 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.h +++ b/Telegram/SourceFiles/data/data_forum_topic.h @@ -76,6 +76,7 @@ public: void discard(); void setRealRootId(MsgId realId); + void readTillEnd(); void applyTopic(const MTPDforumTopic &data); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index ea2d724f9..547f8680e 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -65,7 +65,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_drafts.h" #include "data/data_forum.h" #include "data/data_forum_topic.h" -#include "data/data_replies_list.h" #include "data/data_user.h" #include "data/data_scheduled_messages.h" #include "data/data_histories.h" @@ -134,7 +133,7 @@ void MarkAsReadThread(not_null thread) { } } } else if (const auto topic = thread->asTopic()) { - topic->replies()->readTill(topic->lastKnownServerMessageId()); + topic->readTillEnd(); } }