Don't register message users/channels for bots.

This commit is contained in:
levlam 2023-07-27 13:16:48 +03:00
parent be64ce7049
commit 1fbbecca9b
2 changed files with 2 additions and 8 deletions

View File

@ -9807,9 +9807,6 @@ void ContactsManager::remove_inactive_channel(ChannelId channel_id) {
}
void ContactsManager::register_message_users(FullMessageId full_message_id, vector<UserId> user_ids) {
if (td_->auth_manager_->is_bot()) {
return;
}
for (auto user_id : user_ids) {
CHECK(user_id.is_valid());
const User *u = get_user(user_id);
@ -9825,9 +9822,6 @@ void ContactsManager::register_message_users(FullMessageId full_message_id, vect
}
void ContactsManager::register_message_channels(FullMessageId full_message_id, vector<ChannelId> channel_ids) {
if (td_->auth_manager_->is_bot()) {
return;
}
for (auto channel_id : channel_ids) {
CHECK(channel_id.is_valid());
const Channel *c = get_channel(channel_id);

View File

@ -16538,7 +16538,7 @@ void MessagesManager::on_message_deleted(Dialog *d, Message *m, bool is_permanen
}
break;
case DialogType::Channel:
if (m->message_id.is_server()) {
if (m->message_id.is_server() && !td_->auth_manager_->is_bot()) {
td_->contacts_manager_->unregister_message_users({d->dialog_id, m->message_id}, get_message_user_ids(m));
td_->contacts_manager_->unregister_message_channels({d->dialog_id, m->message_id}, get_message_channel_ids(m));
}
@ -35158,7 +35158,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
}
break;
case DialogType::Channel:
if (m->message_id.is_server()) {
if (m->message_id.is_server() && !td_->auth_manager_->is_bot()) {
td_->contacts_manager_->register_message_users({dialog_id, m->message_id}, get_message_user_ids(m));
td_->contacts_manager_->register_message_channels({dialog_id, m->message_id}, get_message_channel_ids(m));
}