Use get_message_active_reactions instead of get_dialog_active_reactions if appropriate.
This commit is contained in:
parent
e9a155a2a6
commit
c0a2c0de8b
|
@ -6948,7 +6948,7 @@ bool MessagesManager::is_visible_message_reactions(DialogId dialog_id, const Mes
|
|||
|
||||
const Dialog *d = get_dialog(dialog_id);
|
||||
CHECK(d != nullptr);
|
||||
if (get_dialog_active_reactions(d).empty()) {
|
||||
if (get_message_active_reactions(d, m).empty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -8358,6 +8358,20 @@ vector<string> MessagesManager::get_dialog_active_reactions(const Dialog *d) con
|
|||
}
|
||||
}
|
||||
|
||||
vector<string> MessagesManager::get_message_active_reactions(const Dialog *d, const Message *m) const {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(m != nullptr);
|
||||
if (is_discussion_message(d->dialog_id, m)) {
|
||||
d = get_dialog(m->forward_info->from_dialog_id);
|
||||
if (d == nullptr) {
|
||||
LOG(ERROR) << "Failed to find linked " << m->forward_info->from_dialog_id
|
||||
<< " to determine correct active reactions";
|
||||
return vector<string>();
|
||||
}
|
||||
}
|
||||
return get_dialog_active_reactions(d);
|
||||
}
|
||||
|
||||
bool MessagesManager::update_dialog_silent_send_message(Dialog *d, bool silent_send_message) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
// just in case
|
||||
|
@ -23775,7 +23789,7 @@ Result<vector<string>> MessagesManager::get_message_available_reactions(FullMess
|
|||
vector<string> MessagesManager::get_message_available_reactions(const Dialog *d, const Message *m) {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(m != nullptr);
|
||||
auto active_reactions = get_dialog_active_reactions(d);
|
||||
auto active_reactions = get_message_active_reactions(d, m);
|
||||
if (!m->message_id.is_valid() || !m->message_id.is_server() || active_reactions.empty()) {
|
||||
return vector<string>();
|
||||
}
|
||||
|
|
|
@ -2611,6 +2611,8 @@ class MessagesManager final : public Actor {
|
|||
|
||||
vector<string> get_dialog_active_reactions(const Dialog *d) const;
|
||||
|
||||
vector<string> get_message_active_reactions(const Dialog *d, const Message *m) const;
|
||||
|
||||
bool is_dialog_action_unneeded(DialogId dialog_id) const;
|
||||
|
||||
void on_send_dialog_action_timeout(DialogId dialog_id);
|
||||
|
|
Loading…
Reference in New Issue
Block a user