diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index 7ef3347eb..3d8c19ea5 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -964,6 +964,16 @@ td_api::object_ptr MessageReactions::get_message_react can_get_added_reactions_); } +int32 MessageReactions::get_non_paid_reaction_count() const { + int32 result = 0; + for (const auto &reaction : reactions_) { + if (!reaction.reaction_type_.is_paid_reaction()) { + result++; + } + } + return result; +} + void MessageReactions::add_min_channels(Td *td) const { for (const auto &reaction : reactions_) { for (const auto &recent_chooser_min_channel : reaction.get_recent_chooser_min_channels()) { diff --git a/td/telegram/MessageReaction.h b/td/telegram/MessageReaction.h index 2d61fcbec..6d8a68870 100644 --- a/td/telegram/MessageReaction.h +++ b/td/telegram/MessageReaction.h @@ -200,6 +200,8 @@ struct MessageReactions { td_api::object_ptr get_message_reactions_object(Td *td, UserId my_user_id, UserId peer_user_id) const; + int32 get_non_paid_reaction_count() const; + void add_min_channels(Td *td) const; void add_dependencies(Dependencies &dependencies) const; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5c511ce6e..26cb4cbcd 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -22648,7 +22648,7 @@ ChatReactions MessagesManager::get_message_available_reactions(const Dialog *d, reactions_uniq_max = active_reactions.reactions_limit_; } bool can_add_new_reactions = - m->reactions == nullptr || static_cast(m->reactions->reactions_.size()) < reactions_uniq_max; + m->reactions == nullptr || m->reactions->get_non_paid_reaction_count() < reactions_uniq_max; if (!can_use_reactions || !can_add_new_reactions) { active_reactions = ChatReactions();