Fix paid reaction in get_sorted_available_reactions() for channels with disabled paid reaction if it is already set on the message.

This commit is contained in:
levlam 2024-08-07 17:27:25 +03:00
parent 3918e131e3
commit 1bbed2c5bc

View File

@ -571,7 +571,8 @@ td_api::object_ptr<td_api::availableReactions> ReactionManager::get_sorted_avail
CHECK(!reaction_type.is_empty());
all_available_reaction_types.insert(reaction_type);
}
if (available_reactions.paid_reactions_available_) {
if (available_reactions.paid_reactions_available_ ||
(!available_reactions.reaction_types_.empty() && available_reactions.reaction_types_[0].is_paid_reaction())) {
all_available_reaction_types.insert(ReactionType::paid());
top_reactions.insert(top_reactions.begin(), ReactionType::paid());
}
@ -669,6 +670,7 @@ void ReactionManager::add_recent_reaction(const ReactionType &reaction_type) {
if (!reactions.empty() && reactions[0] == reaction_type) {
return;
}
CHECK(!reaction_type.is_paid_reaction());
add_to_top(reactions, MAX_RECENT_REACTIONS, reaction_type);