Mark topics as read on reply from notification.

This commit is contained in:
John Preston 2022-10-25 13:05:14 +04:00
parent ef3ed760b1
commit 06d1644baa
4 changed files with 14 additions and 3 deletions

View file

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

View file

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

View file

@ -76,6 +76,7 @@ public:
void discard();
void setRealRootId(MsgId realId);
void readTillEnd();
void applyTopic(const MTPDforumTopic &data);

View file

@ -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<Data::Thread*> thread) {
}
}
} else if (const auto topic = thread->asTopic()) {
topic->replies()->readTill(topic->lastKnownServerMessageId());
topic->readTillEnd();
}
}