Add "disable_sent_scheduled_message_notifications" option.

GitOrigin-RevId: ad57858024b07b51b89d7b3c28faf20c3e7577da
This commit is contained in:
levlam 2020-02-29 21:17:30 +03:00
parent 0a5d563a2f
commit 44b31537aa
2 changed files with 14 additions and 1 deletions

View File

@ -21410,6 +21410,11 @@ Result<MessagesManager::MessagePushNotificationInfo> MessagesManager::get_messag
return Status::Error(406, "Ignore notification in unknown chat");
}
if (is_from_scheduled && dialog_id != get_my_dialog_id() &&
G()->shared_config().get_option_boolean("disable_sent_scheduled_message_notifications")) {
return Status::Error("Ignore notification about sent scheduled message");
}
bool is_new_pinned = is_pinned && message_id.is_valid() && message_id > d->max_notification_message_id;
CHECK(!message_id.is_scheduled());
if (message_id.is_valid()) {
@ -22207,6 +22212,10 @@ bool MessagesManager::is_message_notification_disabled(const Dialog *d, const Me
if (!has_incoming_notification(d->dialog_id, m) || td_->auth_manager_->is_bot()) {
return true;
}
if (m->is_from_scheduled && d->dialog_id != get_my_dialog_id() &&
G()->shared_config().get_option_boolean("disable_sent_scheduled_message_notifications")) {
return true;
}
switch (m->content->get_type()) {
case MessageContentType::ChatDeleteHistory:
@ -27265,7 +27274,8 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
}
if (old_message->is_from_scheduled != new_message->is_from_scheduled) {
old_message->is_from_scheduled = new_message->is_from_scheduled;
// is_from_scheduled flag shouldn't be changed, because we are unable to show/hide message notification
// old_message->is_from_scheduled = new_message->is_from_scheduled;
}
if (old_message->edit_date > 0) {

View File

@ -6718,6 +6718,9 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
if (!is_bot && set_boolean_option("disable_contact_registered_notifications")) {
return;
}
if (!is_bot && set_boolean_option("disable_sent_scheduled_message_notifications")) {
return;
}
if (!is_bot && set_boolean_option("disable_top_chats")) {
return;
}