diff --git a/Telegram/SourceFiles/data/data_sponsored_messages.cpp b/Telegram/SourceFiles/data/data_sponsored_messages.cpp index c095c1220..66adb4d0f 100644 --- a/Telegram/SourceFiles/data/data_sponsored_messages.cpp +++ b/Telegram/SourceFiles/data/data_sponsored_messages.cpp @@ -151,7 +151,9 @@ void SponsoredMessages::append( }); const auto randomId = data.vrandom_id().v; const auto hash = qs(data.vchat_invite_hash().value_or_empty()); - const auto makeFrom = [](not_null peer) { + const auto makeFrom = []( + not_null peer, + bool exactPost = false) { const auto channel = peer->asChannel(); return SponsoredFrom{ .peer = peer, @@ -161,12 +163,14 @@ void SponsoredMessages::append( .isChannel = (channel != nullptr), .isPublic = (channel && channel->isPublic()), .isBot = (peer->isUser() && peer->asUser()->isBot()), + .isExactPost = exactPost, }; }; const auto from = [&]() -> SponsoredFrom { if (data.vfrom_id()) { return makeFrom( - _session->data().peer(peerFromMTP(*data.vfrom_id()))); + _session->data().peer(peerFromMTP(*data.vfrom_id())), + (data.vchannel_post() != nullptr)); } Assert(data.vchat_invite()); return data.vchat_invite()->match([](const MTPDchatInvite &data) { diff --git a/Telegram/SourceFiles/data/data_sponsored_messages.h b/Telegram/SourceFiles/data/data_sponsored_messages.h index 5e3109feb..eaa980661 100644 --- a/Telegram/SourceFiles/data/data_sponsored_messages.h +++ b/Telegram/SourceFiles/data/data_sponsored_messages.h @@ -28,6 +28,7 @@ struct SponsoredFrom { bool isChannel = false; bool isPublic = false; bool isBot = false; + bool isExactPost = false; }; struct SponsoredMessage { diff --git a/Telegram/SourceFiles/history/history_item_components.h b/Telegram/SourceFiles/history/history_item_components.h index 87021780b..7a84be750 100644 --- a/Telegram/SourceFiles/history/history_item_components.h +++ b/Telegram/SourceFiles/history/history_item_components.h @@ -107,6 +107,7 @@ struct HistoryMessageSponsored : public RuntimeComponent sender; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 0634657eb..bce048a8b 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1947,7 +1947,9 @@ void HistoryMessage::setSponsoredFrom(const Data::SponsoredFrom &from) { false); using Type = HistoryMessageSponsored::Type; - sponsored->type = from.isBot + sponsored->type = from.isExactPost + ? Type::Post + : from.isBot ? Type::Bot : from.isBroadcast ? Type::Broadcast diff --git a/Telegram/SourceFiles/history/view/history_view_view_button.cpp b/Telegram/SourceFiles/history/view/history_view_view_button.cpp index 783b0878c..5e0d2cb4c 100644 --- a/Telegram/SourceFiles/history/view/history_view_view_button.cpp +++ b/Telegram/SourceFiles/history/view/history_view_view_button.cpp @@ -36,10 +36,11 @@ using SponsoredType = HistoryMessageSponsored::Type; inline auto SponsoredPhrase(SponsoredType type) { const auto phrase = [&] { switch (type) { - case SponsoredType::Bot: return tr::lng_view_button_bot; + case SponsoredType::User: return tr::lng_view_button_user; case SponsoredType::Group: return tr::lng_view_button_group; case SponsoredType::Broadcast: return tr::lng_view_button_channel; - case SponsoredType::User: return tr::lng_view_button_user; + case SponsoredType::Post: return tr::lng_view_button_message; + case SponsoredType::Bot: return tr::lng_view_button_bot; } Unexpected("SponsoredType in SponsoredPhrase."); }();