Keep only active reactions.

This commit is contained in:
levlam 2022-01-19 20:35:49 +03:00
parent 5f14c85a33
commit 4a2cace483

View File

@ -8241,8 +8241,18 @@ vector<string> MessagesManager::get_active_reactions(const vector<string> &avail
vector<string> MessagesManager::get_active_reactions(const vector<string> &available_reactions,
const vector<string> &active_reactions) {
if (available_reactions.empty() || available_reactions == active_reactions) {
// fast path
return available_reactions;
}
vector<string> result;
for (const auto &active_reaction : active_reactions) {
if (td::contains(available_reactions, active_reaction)) {
result.push_back(active_reaction);
}
}
return result;
}
vector<string> MessagesManager::get_dialog_active_reactions(const Dialog *d) const {
CHECK(d != nullptr);