Support reaction tags in getMessageAvailableReactions.
This commit is contained in:
parent
ed4f18bfaf
commit
b9afcbb70c
@ -22622,6 +22622,11 @@ Result<td_api::object_ptr<td_api::availableReactions>> MessagesManager::get_mess
|
|||||||
get_message_active_reactions(d, m), row_size);
|
get_message_active_reactions(d, m), row_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MessagesManager::can_add_message_tag(DialogId dialog_id, const MessageReactions *reactions) const {
|
||||||
|
return dialog_id == td_->dialog_manager_->get_my_dialog_id() &&
|
||||||
|
(reactions == nullptr || reactions->reactions_.empty() || reactions->are_tags_);
|
||||||
|
}
|
||||||
|
|
||||||
ChatReactions MessagesManager::get_message_available_reactions(const Dialog *d, const Message *m,
|
ChatReactions MessagesManager::get_message_available_reactions(const Dialog *d, const Message *m,
|
||||||
bool disallow_custom_for_non_premium) {
|
bool disallow_custom_for_non_premium) {
|
||||||
CHECK(d != nullptr);
|
CHECK(d != nullptr);
|
||||||
@ -22656,7 +22661,12 @@ ChatReactions MessagesManager::get_message_available_reactions(const Dialog *d,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (active_reactions.allow_all_regular_) {
|
if (active_reactions.allow_all_regular_) {
|
||||||
active_reactions.reaction_types_ = active_reaction_types_;
|
if (can_add_message_tag(d->dialog_id, m->reactions.get())) {
|
||||||
|
active_reactions.reaction_types_ = td_->reaction_manager_->get_default_tag_reactions();
|
||||||
|
disallow_custom_for_non_premium = true;
|
||||||
|
} else {
|
||||||
|
active_reactions.reaction_types_ = active_reaction_types_;
|
||||||
|
}
|
||||||
active_reactions.allow_all_regular_ = false;
|
active_reactions.allow_all_regular_ = false;
|
||||||
}
|
}
|
||||||
if (can_use_reactions && m->reactions != nullptr) {
|
if (can_use_reactions && m->reactions != nullptr) {
|
||||||
|
@ -2520,6 +2520,8 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
void set_dialog_message_ttl(Dialog *d, MessageTtl message_ttl);
|
void set_dialog_message_ttl(Dialog *d, MessageTtl message_ttl);
|
||||||
|
|
||||||
|
bool can_add_message_tag(DialogId dialog_id, const MessageReactions *reactions) const;
|
||||||
|
|
||||||
ChatReactions get_message_available_reactions(const Dialog *d, const Message *m,
|
ChatReactions get_message_available_reactions(const Dialog *d, const Message *m,
|
||||||
bool disallow_custom_for_non_premium);
|
bool disallow_custom_for_non_premium);
|
||||||
|
|
||||||
|
@ -359,6 +359,12 @@ void ReactionManager::clear_recent_reactions(Promise<Unit> &&promise) {
|
|||||||
td_->create_handler<ClearRecentReactionsQuery>(std::move(promise))->send();
|
td_->create_handler<ClearRecentReactionsQuery>(std::move(promise))->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<ReactionType> ReactionManager::get_default_tag_reactions() {
|
||||||
|
load_reaction_list(ReactionListType::DefaultTag);
|
||||||
|
|
||||||
|
return get_reaction_list(ReactionListType::DefaultTag).reaction_types_;
|
||||||
|
}
|
||||||
|
|
||||||
void ReactionManager::reload_reactions() {
|
void ReactionManager::reload_reactions() {
|
||||||
if (G()->close_flag() || reactions_.are_being_reloaded_) {
|
if (G()->close_flag() || reactions_.are_being_reloaded_) {
|
||||||
return;
|
return;
|
||||||
|
@ -51,6 +51,8 @@ class ReactionManager final : public Actor {
|
|||||||
|
|
||||||
void clear_recent_reactions(Promise<Unit> &&promise);
|
void clear_recent_reactions(Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
vector<ReactionType> get_default_tag_reactions();
|
||||||
|
|
||||||
void reload_reactions();
|
void reload_reactions();
|
||||||
|
|
||||||
void reload_reaction_list(ReactionListType reaction_list_type);
|
void reload_reaction_list(ReactionListType reaction_list_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user