Always send updateScopeNotificationSettings.

GitOrigin-RevId: 60d7e10e9b9e7d1f67f80cd7193ade42e52f3ef9
This commit is contained in:
levlam 2019-01-11 03:30:55 +03:00
parent 9b95544677
commit 042c43ff46

View File

@ -5786,8 +5786,12 @@ bool MessagesManager::update_scope_notification_settings(NotificationSettingsSco
bool need_update_local = bool need_update_local =
current_settings->disable_pinned_message_notifications != new_settings.disable_pinned_message_notifications || current_settings->disable_pinned_message_notifications != new_settings.disable_pinned_message_notifications ||
current_settings->disable_mention_notifications != new_settings.disable_mention_notifications; current_settings->disable_mention_notifications != new_settings.disable_mention_notifications;
bool is_changed = bool was_inited = current_settings->is_synchronized;
need_update_server || need_update_local || current_settings->is_synchronized != new_settings.is_synchronized; bool is_inited = new_settings.is_synchronized;
if (was_inited && !is_inited) {
return false; // just in case
}
bool is_changed = need_update_server || need_update_local || was_inited != is_inited;
if (is_changed) { if (is_changed) {
save_scope_notification_settings(scope, new_settings); save_scope_notification_settings(scope, new_settings);
@ -5822,9 +5826,7 @@ bool MessagesManager::update_scope_notification_settings(NotificationSettingsSco
LOG(INFO) << "Update notification settings in " << scope << " from " << *current_settings << " to " << new_settings; LOG(INFO) << "Update notification settings in " << scope << " from " << *current_settings << " to " << new_settings;
*current_settings = new_settings; *current_settings = new_settings;
if (need_update_server || need_update_local) { send_closure(G()->td(), &Td::send_update, get_update_scope_notification_settings_object(scope));
send_closure(G()->td(), &Td::send_update, get_update_scope_notification_settings_object(scope));
}
} }
return need_update_server; return need_update_server;
} }