Disallow to report support accounts.

GitOrigin-RevId: 40657f51e7b4ca90e930b406d4903e132865babd
This commit is contained in:
levlam 2019-03-17 18:09:28 +03:00
parent 8fc712470e
commit f9a0b34cb2
3 changed files with 8 additions and 1 deletions

View File

@ -8591,6 +8591,11 @@ Result<BotData> ContactsManager::get_bot_data(UserId user_id) const {
return bot_data; 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 { const ContactsManager::User *ContactsManager::get_user(UserId user_id) const {
auto p = users_.find(user_id); auto p = users_.find(user_id);
if (p == users_.end()) { if (p == users_.end()) {

View File

@ -336,6 +336,8 @@ class ContactsManager : public Actor {
bool is_user_bot(UserId user_id) const; bool is_user_bot(UserId user_id) const;
Result<BotData> get_bot_data(UserId user_id) const TD_WARN_UNUSED_RESULT; Result<BotData> 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_user(UserId user_id) const;
bool have_min_user(UserId user_id) const; bool have_min_user(UserId user_id) const;
bool have_user_force(UserId user_id); bool have_user_force(UserId user_id);

View File

@ -6138,7 +6138,7 @@ void MessagesManager::change_dialog_report_spam_state_on_server(DialogId dialog_
bool MessagesManager::can_report_dialog(DialogId dialog_id) const { bool MessagesManager::can_report_dialog(DialogId dialog_id) const {
switch (dialog_id.get_type()) { switch (dialog_id.get_type()) {
case DialogType::User: 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: case DialogType::Chat:
return false; return false;
case DialogType::Channel: case DialogType::Channel: