mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Skip custom reactions if premium isn't possible.
This commit is contained in:
parent
26c79939e0
commit
c2fd4ccd59
1 changed files with 7 additions and 3 deletions
|
@ -98,6 +98,7 @@ PossibleItemReactionsRef LookupPossibleReactions(
|
||||||
const auto &recent = reactions->list(Reactions::Type::Recent);
|
const auto &recent = reactions->list(Reactions::Type::Recent);
|
||||||
const auto &all = item->reactions();
|
const auto &all = item->reactions();
|
||||||
const auto limit = UniqueReactionsLimit(peer);
|
const auto limit = UniqueReactionsLimit(peer);
|
||||||
|
const auto premiumPossible = session->premiumPossible();
|
||||||
const auto limited = (all.size() >= limit) && [&] {
|
const auto limited = (all.size() >= limit) && [&] {
|
||||||
const auto my = item->chosenReactions();
|
const auto my = item->chosenReactions();
|
||||||
if (my.empty()) {
|
if (my.empty()) {
|
||||||
|
@ -137,7 +138,9 @@ PossibleItemReactionsRef LookupPossibleReactions(
|
||||||
: full.size());
|
: full.size());
|
||||||
add([&](const Reaction &reaction) {
|
add([&](const Reaction &reaction) {
|
||||||
const auto id = reaction.id;
|
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)) {
|
&& !ranges::contains(allowed.some, id)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (id.custom()
|
} else if (id.custom()
|
||||||
|
@ -146,14 +149,15 @@ PossibleItemReactionsRef LookupPossibleReactions(
|
||||||
} else if (reaction.premium
|
} else if (reaction.premium
|
||||||
&& !session->premium()
|
&& !session->premium()
|
||||||
&& !ranges::contains(all, id, &MessageReaction::id)) {
|
&& !ranges::contains(all, id, &MessageReaction::id)) {
|
||||||
if (session->premiumPossible()) {
|
if (premiumPossible) {
|
||||||
result.morePremiumAvailable = true;
|
result.morePremiumAvailable = true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
result.customAllowed = (allowed.type == AllowedReactionsType::All);
|
result.customAllowed = (allowed.type == AllowedReactionsType::All)
|
||||||
|
&& premiumPossible;
|
||||||
}
|
}
|
||||||
const auto i = ranges::find(
|
const auto i = ranges::find(
|
||||||
result.recent,
|
result.recent,
|
||||||
|
|
Loading…
Add table
Reference in a new issue