Fix marking stories as read.

This commit is contained in:
John Preston 2023-07-19 18:34:04 +04:00
parent 99926be57a
commit c2805d92a5
1 changed files with 4 additions and 1 deletions

View File

@ -286,7 +286,10 @@ void Stories::processExpired() {
void Stories::parseAndApply(const MTPUserStories &stories) { void Stories::parseAndApply(const MTPUserStories &stories) {
const auto &data = stories.data(); const auto &data = stories.data();
const auto peerId = peerFromUser(data.vuser_id()); const auto peerId = peerFromUser(data.vuser_id());
const auto readTill = data.vmax_read_id().value_or_empty(); const auto already = _readTill.find(peerId);
const auto readTill = std::max(
data.vmax_read_id().value_or_empty(),
(already != end(_readTill) ? already->second : 0));
const auto user = _owner->peer(peerId)->asUser(); const auto user = _owner->peer(peerId)->asUser();
auto result = StoriesSource{ auto result = StoriesSource{
.user = user, .user = user,