Don't store pending join requests for bots.

This commit is contained in:
levlam 2021-11-02 17:51:52 +03:00
parent d732789cac
commit 239f46b075

View File

@ -30510,6 +30510,9 @@ void MessagesManager::set_dialog_theme_name(Dialog *d, string theme_name) {
void MessagesManager::drop_dialog_pending_join_requests(DialogId dialog_id) {
CHECK(dialog_id.is_valid());
if (td_->auth_manager_->is_bot()) {
return;
}
auto d = get_dialog(dialog_id); // called from update_chat/channel, must not create the dialog
if (d != nullptr && d->is_update_new_chat_sent) {
set_dialog_pending_join_requests(d, 0, {});
@ -30522,6 +30525,9 @@ void MessagesManager::on_update_dialog_pending_join_requests(DialogId dialog_id,
LOG(ERROR) << "Receive pending join request count in invalid " << dialog_id;
return;
}
if (td_->auth_manager_->is_bot()) {
return;
}
auto d = get_dialog_force(dialog_id, "on_update_dialog_pending_join_request_count");
if (d == nullptr) {
@ -30578,6 +30584,10 @@ void MessagesManager::fix_pending_join_requests(DialogId dialog_id, int32 &pendi
void MessagesManager::set_dialog_pending_join_requests(Dialog *d, int32 pending_join_request_count,
vector<UserId> pending_join_request_user_ids) {
if (td_->auth_manager_->is_bot()) {
return;
}
CHECK(d != nullptr);
fix_pending_join_requests(d->dialog_id, pending_join_request_count, pending_join_request_user_ids);
if (d->pending_join_request_count == pending_join_request_count &&