From c2fd4ccd596da6ea633a0e2c27e742c5f3a779ea Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 12 Sep 2022 10:07:07 +0400 Subject: [PATCH] Skip custom reactions if premium isn't possible. --- Telegram/SourceFiles/data/data_message_reactions.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/data/data_message_reactions.cpp b/Telegram/SourceFiles/data/data_message_reactions.cpp index 8d5bfa6f7..a918aa08c 100644 --- a/Telegram/SourceFiles/data/data_message_reactions.cpp +++ b/Telegram/SourceFiles/data/data_message_reactions.cpp @@ -98,6 +98,7 @@ PossibleItemReactionsRef LookupPossibleReactions( const auto &recent = reactions->list(Reactions::Type::Recent); const auto &all = item->reactions(); const auto limit = UniqueReactionsLimit(peer); + const auto premiumPossible = session->premiumPossible(); const auto limited = (all.size() >= limit) && [&] { const auto my = item->chosenReactions(); if (my.empty()) { @@ -137,7 +138,9 @@ PossibleItemReactionsRef LookupPossibleReactions( : full.size()); add([&](const Reaction &reaction) { const auto id = reaction.id; - if ((allowed.type == AllowedReactionsType::Some) + if (id.custom() && !premiumPossible) { + return false; + } else if ((allowed.type == AllowedReactionsType::Some) && !ranges::contains(allowed.some, id)) { return false; } else if (id.custom() @@ -146,14 +149,15 @@ PossibleItemReactionsRef LookupPossibleReactions( } else if (reaction.premium && !session->premium() && !ranges::contains(all, id, &MessageReaction::id)) { - if (session->premiumPossible()) { + if (premiumPossible) { result.morePremiumAvailable = true; } return false; } return true; }); - result.customAllowed = (allowed.type == AllowedReactionsType::All); + result.customAllowed = (allowed.type == AllowedReactionsType::All) + && premiumPossible; } const auto i = ranges::find( result.recent,