| 700 | } |
| 701 | |
| 702 | void Story::applyFields( |
| 703 | StoryMedia media, |
| 704 | const MTPDstoryItem &data, |
| 705 | TimeId now, |
| 706 | bool initial) { |
| 707 | _lastUpdateTime = now; |
| 708 | |
| 709 | const auto reaction = data.is_min() |
| 710 | ? _sentReactionId |
| 711 | : data.vsent_reaction() |
| 712 | ? Data::ReactionFromMTP(*data.vsent_reaction()) |
| 713 | : Data::ReactionId(); |
| 714 | const auto inProfile = data.is_pinned(); |
| 715 | const auto edited = data.is_edited(); |
| 716 | const auto privacy = data.is_public() |
| 717 | ? StoryPrivacy::Public |
| 718 | : data.is_close_friends() |
| 719 | ? StoryPrivacy::CloseFriends |
| 720 | : data.is_contacts() |
| 721 | ? StoryPrivacy::Contacts |
| 722 | : data.is_selected_contacts() |
| 723 | ? StoryPrivacy::SelectedContacts |
| 724 | : StoryPrivacy::Other; |
| 725 | const auto noForwards = data.is_noforwards(); |
| 726 | const auto out = data.is_min() ? _out : data.is_out(); |
| 727 | auto caption = TextWithEntities{ |
| 728 | data.vcaption().value_or_empty(), |
| 729 | Api::EntitiesFromMTP( |
| 730 | &session(), |
| 731 | data.ventities().value_or_empty()), |
| 732 | }; |
| 733 | if (const auto user = _peer->asUser()) { |
| 734 | if (!user->isVerified() && !user->isPremium()) { |
| 735 | caption = StripLinks(std::move(caption)); |
| 736 | } |
| 737 | } |
| 738 | auto counts = ViewsCounts(); |
| 739 | auto viewsKnown = _views.known; |
| 740 | if (const auto info = data.vviews()) { |
| 741 | counts = parseViewsCounts(info->data(), reaction); |
| 742 | viewsKnown = true; |
| 743 | } else { |
| 744 | counts.views = _views.total; |
| 745 | counts.forwards = _views.forwards; |
| 746 | counts.reactions = _views.reactions; |
| 747 | counts.viewers = _recentViewers; |
| 748 | for (const auto &suggested : _suggestedReactions) { |
| 749 | if (const auto count = suggested.count) { |
| 750 | counts.reactionsCounts[suggested.reaction] = count; |
| 751 | } |
| 752 | } |
| 753 | } |
| 754 | auto locations = std::vector<StoryLocation>(); |
| 755 | auto suggestedReactions = std::vector<SuggestedReaction>(); |
| 756 | auto channelPosts = std::vector<ChannelPost>(); |
| 757 | auto urlAreas = std::vector<UrlArea>(); |
| 758 | auto weatherAreas = std::vector<WeatherArea>(); |
| 759 | if (const auto areas = data.vmedia_areas()) { |
nothing calls this directly
no test coverage detected