mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
More correct way of applying min stories.
This commit is contained in:
parent
0f8d9e885a
commit
98ab91a56a
1 changed files with 15 additions and 13 deletions
|
@ -469,7 +469,9 @@ void Story::applyFields(
|
||||||
bool initial) {
|
bool initial) {
|
||||||
_lastUpdateTime = now;
|
_lastUpdateTime = now;
|
||||||
|
|
||||||
const auto reaction = data.vsent_reaction()
|
const auto reaction = data.is_min()
|
||||||
|
? _sentReactionId
|
||||||
|
: data.vsent_reaction()
|
||||||
? Data::ReactionFromMTP(*data.vsent_reaction())
|
? Data::ReactionFromMTP(*data.vsent_reaction())
|
||||||
: Data::ReactionId();
|
: Data::ReactionId();
|
||||||
const auto pinned = data.is_pinned();
|
const auto pinned = data.is_pinned();
|
||||||
|
@ -493,20 +495,20 @@ void Story::applyFields(
|
||||||
auto views = _views.total;
|
auto views = _views.total;
|
||||||
auto reactions = _views.reactions;
|
auto reactions = _views.reactions;
|
||||||
auto viewers = std::vector<not_null<PeerData*>>();
|
auto viewers = std::vector<not_null<PeerData*>>();
|
||||||
if (!data.is_min()) {
|
if (const auto info = data.vviews()) {
|
||||||
if (const auto info = data.vviews()) {
|
views = info->data().vviews_count().v;
|
||||||
views = info->data().vviews_count().v;
|
reactions = info->data().vreactions_count().v;
|
||||||
reactions = info->data().vreactions_count().v;
|
if (const auto list = info->data().vrecent_viewers()) {
|
||||||
if (const auto list = info->data().vrecent_viewers()) {
|
viewers.reserve(list->v.size());
|
||||||
viewers.reserve(list->v.size());
|
auto &owner = _peer->owner();
|
||||||
auto &owner = _peer->owner();
|
auto &&cut = list->v
|
||||||
auto &&cut = list->v
|
| ranges::views::take(kRecentViewersMax);
|
||||||
| ranges::views::take(kRecentViewersMax);
|
for (const auto &id : cut) {
|
||||||
for (const auto &id : cut) {
|
viewers.push_back(owner.peer(peerFromUser(id)));
|
||||||
viewers.push_back(owner.peer(peerFromUser(id)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
viewers = _recentViewers;
|
||||||
}
|
}
|
||||||
auto locations = std::vector<StoryLocation>();
|
auto locations = std::vector<StoryLocation>();
|
||||||
if (const auto areas = data.vmedia_areas()) {
|
if (const auto areas = data.vmedia_areas()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue