From 1bbed2c5bc7d9824fab2fff00fa442562fb55944 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 7 Aug 2024 17:27:25 +0300 Subject: [PATCH] Fix paid reaction in get_sorted_available_reactions() for channels with disabled paid reaction if it is already set on the message. --- td/telegram/ReactionManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/td/telegram/ReactionManager.cpp b/td/telegram/ReactionManager.cpp index cdf815940..982551713 100644 --- a/td/telegram/ReactionManager.cpp +++ b/td/telegram/ReactionManager.cpp @@ -571,7 +571,8 @@ td_api::object_ptr 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);