From 98ab91a56a5721a12feb7d7ab0e11e59c6482949 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 14 Sep 2023 10:58:29 +0400 Subject: [PATCH] More correct way of applying min stories. --- Telegram/SourceFiles/data/data_story.cpp | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/data/data_story.cpp b/Telegram/SourceFiles/data/data_story.cpp index fab608d99..fa344d24f 100644 --- a/Telegram/SourceFiles/data/data_story.cpp +++ b/Telegram/SourceFiles/data/data_story.cpp @@ -469,7 +469,9 @@ void Story::applyFields( bool initial) { _lastUpdateTime = now; - const auto reaction = data.vsent_reaction() + const auto reaction = data.is_min() + ? _sentReactionId + : data.vsent_reaction() ? Data::ReactionFromMTP(*data.vsent_reaction()) : Data::ReactionId(); const auto pinned = data.is_pinned(); @@ -493,20 +495,20 @@ void Story::applyFields( auto views = _views.total; auto reactions = _views.reactions; auto viewers = std::vector>(); - if (!data.is_min()) { - if (const auto info = data.vviews()) { - views = info->data().vviews_count().v; - reactions = info->data().vreactions_count().v; - if (const auto list = info->data().vrecent_viewers()) { - viewers.reserve(list->v.size()); - auto &owner = _peer->owner(); - auto &&cut = list->v - | ranges::views::take(kRecentViewersMax); - for (const auto &id : cut) { - viewers.push_back(owner.peer(peerFromUser(id))); - } + if (const auto info = data.vviews()) { + views = info->data().vviews_count().v; + reactions = info->data().vreactions_count().v; + if (const auto list = info->data().vrecent_viewers()) { + viewers.reserve(list->v.size()); + auto &owner = _peer->owner(); + auto &&cut = list->v + | ranges::views::take(kRecentViewersMax); + for (const auto &id : cut) { + viewers.push_back(owner.peer(peerFromUser(id))); } } + } else { + viewers = _recentViewers; } auto locations = std::vector(); if (const auto areas = data.vmedia_areas()) {