Do not notifiations about messages from inactive basic groups.

GitOrigin-RevId: a930e5f235ecf133347705e50d6647615dded091
This commit is contained in:
levlam 2019-01-07 17:54:45 +03:00
parent 915b9c70a5
commit a6bb57d3dd

View File

@ -18242,16 +18242,29 @@ bool MessagesManager::add_new_message_notification(Dialog *d, Message *m, bool f
return false; return false;
} }
if (d->dialog_id.get_type() == DialogType::Channel) { switch (d->dialog_id.get_type()) {
case DialogType::User:
break;
case DialogType::Chat:
if (!td_->contacts_manager_->get_chat_is_active(d->dialog_id.get_chat_id()) ||
m->content->get_type() == MessageContentType::ChatMigrateTo) {
return false;
}
break;
case DialogType::Channel:
if (!td_->contacts_manager_->get_channel_status(d->dialog_id.get_channel_id()).is_member() || if (!td_->contacts_manager_->get_channel_status(d->dialog_id.get_channel_id()).is_member() ||
m->date < td_->contacts_manager_->get_channel_date(d->dialog_id.get_channel_id())) { m->date < td_->contacts_manager_->get_channel_date(d->dialog_id.get_channel_id())) {
return false; return false;
} }
} break;
if (d->dialog_id.get_type() == DialogType::SecretChat) { case DialogType::SecretChat:
if (td_->contacts_manager_->get_secret_chat_state(d->dialog_id.get_secret_chat_id()) == SecretChatState::Closed) { if (td_->contacts_manager_->get_secret_chat_state(d->dialog_id.get_secret_chat_id()) == SecretChatState::Closed) {
return false; return false;
} }
break;
case DialogType::None:
default:
UNREACHABLE();
} }
VLOG(notifications) << "Trying to " << (force ? "forcely " : "") << "add new message notification for " VLOG(notifications) << "Trying to " << (force ? "forcely " : "") << "add new message notification for "