diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index b305f87e..5c97cf0b 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -8591,6 +8591,11 @@ Result ContactsManager::get_bot_data(UserId user_id) const { return bot_data; } +bool ContactsManager::can_report_user(UserId user_id) const { + auto u = get_user(user_id); + return u != nullptr && !u->is_deleted && u->is_bot && !u->is_support; +} + const ContactsManager::User *ContactsManager::get_user(UserId user_id) const { auto p = users_.find(user_id); if (p == users_.end()) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index ee4b4f35..44096334 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -336,6 +336,8 @@ class ContactsManager : public Actor { bool is_user_bot(UserId user_id) const; Result get_bot_data(UserId user_id) const TD_WARN_UNUSED_RESULT; + bool can_report_user(UserId user_id) const; + bool have_user(UserId user_id) const; bool have_min_user(UserId user_id) const; bool have_user_force(UserId user_id); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 605817dd..88ea53a1 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6138,7 +6138,7 @@ void MessagesManager::change_dialog_report_spam_state_on_server(DialogId dialog_ bool MessagesManager::can_report_dialog(DialogId dialog_id) const { switch (dialog_id.get_type()) { case DialogType::User: - return td_->contacts_manager_->is_user_bot(dialog_id.get_user_id()); + return td_->contacts_manager_->can_report_user(dialog_id.get_user_id()); case DialogType::Chat: return false; case DialogType::Channel: