Add and use ChatReactions::ignore_non_paid_reaction_types.
This commit is contained in:
parent
56ef439ff8
commit
3918e131e3
@ -124,6 +124,12 @@ telegram_api::object_ptr<telegram_api::ChatReactions> ChatReactions::get_input_c
|
|||||||
return telegram_api::make_object<telegram_api::chatReactionsNone>();
|
return telegram_api::make_object<telegram_api::chatReactionsNone>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatReactions::ignore_non_paid_reaction_types() {
|
||||||
|
reaction_types_.clear();
|
||||||
|
allow_all_regular_ = false;
|
||||||
|
allow_all_custom_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const ChatReactions &lhs, const ChatReactions &rhs) {
|
bool operator==(const ChatReactions &lhs, const ChatReactions &rhs) {
|
||||||
// don't compare allow_all_custom_
|
// don't compare allow_all_custom_
|
||||||
return lhs.reaction_types_ == rhs.reaction_types_ && lhs.allow_all_regular_ == rhs.allow_all_regular_ &&
|
return lhs.reaction_types_ == rhs.reaction_types_ && lhs.allow_all_regular_ == rhs.allow_all_regular_ &&
|
||||||
|
@ -55,6 +55,8 @@ struct ChatReactions {
|
|||||||
return reaction_types_.empty() && !allow_all_regular_ && !paid_reactions_available_;
|
return reaction_types_.empty() && !allow_all_regular_ && !paid_reactions_available_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ignore_non_paid_reaction_types();
|
||||||
|
|
||||||
bool remove_paid_reactions();
|
bool remove_paid_reactions();
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
|
@ -22650,8 +22650,10 @@ ChatReactions MessagesManager::get_message_available_reactions(const Dialog *d,
|
|||||||
bool can_add_new_reactions =
|
bool can_add_new_reactions =
|
||||||
m->reactions == nullptr || m->reactions->get_non_paid_reaction_count() < reactions_uniq_max;
|
m->reactions == nullptr || m->reactions->get_non_paid_reaction_count() < reactions_uniq_max;
|
||||||
|
|
||||||
if (!can_use_reactions || !can_add_new_reactions) {
|
if (!can_use_reactions) {
|
||||||
active_reactions = ChatReactions();
|
active_reactions = ChatReactions();
|
||||||
|
} else if (!can_add_new_reactions) {
|
||||||
|
active_reactions.ignore_non_paid_reaction_types();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_reactions.allow_all_regular_) {
|
if (active_reactions.allow_all_regular_) {
|
||||||
|
@ -551,7 +551,8 @@ td_api::object_ptr<td_api::availableReactions> ReactionManager::get_sorted_avail
|
|||||||
top_reactions = get_reaction_list(ReactionListType::Top).reaction_types_;
|
top_reactions = get_reaction_list(ReactionListType::Top).reaction_types_;
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Have available reactions " << available_reactions << " to be sorted by top reactions " << top_reactions
|
LOG(INFO) << "Have available reactions " << available_reactions << " to be sorted by top reactions " << top_reactions
|
||||||
<< " and recent reactions " << recent_reactions;
|
<< " and recent reactions " << recent_reactions
|
||||||
|
<< " and paid reaction = " << available_reactions.paid_reactions_available_;
|
||||||
if (active_reactions.allow_all_custom_ && active_reactions.allow_all_regular_) {
|
if (active_reactions.allow_all_custom_ && active_reactions.allow_all_regular_) {
|
||||||
for (auto &reaction_type : recent_reactions) {
|
for (auto &reaction_type : recent_reactions) {
|
||||||
if (reaction_type.is_custom_reaction()) {
|
if (reaction_type.is_custom_reaction()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user