Send updateChatAvailableReactions updates when the list of active reactions changes.

This commit is contained in:
levlam 2022-01-19 20:04:59 +03:00
parent facb8f754a
commit 5f14c85a33
2 changed files with 30 additions and 0 deletions

View File

@ -8210,10 +8210,37 @@ void MessagesManager::set_active_reactions(vector<string> active_reactions) {
return;
}
auto old_active_reactions = std::move(active_reactions_);
active_reactions_ = std::move(active_reactions);
for (const auto &dialog : dialogs_) {
const Dialog *d = dialog.second.get();
switch (d->dialog_id.get_type()) {
case DialogType::User:
send_update_chat_available_reactions(d);
break;
case DialogType::Chat:
case DialogType::Channel:
if (get_active_reactions(d->available_reactions, old_active_reactions) !=
get_active_reactions(d->available_reactions, active_reactions_)) {
send_update_chat_available_reactions(d);
}
break;
case DialogType::SecretChat:
break;
default:
UNREACHABLE();
break;
}
}
}
vector<string> MessagesManager::get_active_reactions(const vector<string> &available_reactions) const {
return get_active_reactions(available_reactions, active_reactions_);
}
vector<string> MessagesManager::get_active_reactions(const vector<string> &available_reactions,
const vector<string> &active_reactions) {
return available_reactions;
}

View File

@ -2584,6 +2584,9 @@ class MessagesManager final : public Actor {
vector<string> get_active_reactions(const vector<string> &available_reactions) const;
static vector<string> get_active_reactions(const vector<string> &available_reactions,
const vector<string> &active_reactions);
vector<string> get_dialog_active_reactions(const Dialog *d) const;
bool is_dialog_action_unneeded(DialogId dialog_id) const;