Add MessagesManager::send_get_scope_notification_settings_query.

GitOrigin-RevId: d4bc141bb3d5e730427cc07df21d82461312db74
This commit is contained in:
levlam 2018-10-02 01:30:03 +03:00
parent 4d8a832b7d
commit 21ac4d41d1
2 changed files with 11 additions and 4 deletions

View File

@ -3126,7 +3126,7 @@ class UpdateScopeNotifySettingsQuery : public Td::ResultHandler {
if (!td->auth_manager_->is_bot()) {
// trying to repair notification settings for this scope
td->create_handler<GetScopeNotifySettingsQuery>(Promise<>())->send(scope_);
td->messages_manager_->send_get_scope_notification_settings_query(scope_, Promise<>());
}
promise_.set_error(std::move(status));
@ -12279,7 +12279,7 @@ const ScopeNotificationSettings *MessagesManager::get_scope_notification_setting
const ScopeNotificationSettings *notification_settings = get_scope_notification_settings(scope);
CHECK(notification_settings != nullptr);
if (!notification_settings->is_synchronized && !td_->auth_manager_->is_bot()) {
td_->create_handler<GetScopeNotifySettingsQuery>(std::move(promise))->send(scope);
send_get_scope_notification_settings_query(scope, std::move(promise));
return nullptr;
}
@ -18203,6 +18203,11 @@ void MessagesManager::send_get_dialog_notification_settings_query(DialogId dialo
td_->create_handler<GetDialogNotifySettingsQuery>()->send(dialog_id);
}
void MessagesManager::send_get_scope_notification_settings_query(NotificationSettingsScope scope,
Promise<Unit> &&promise) {
td_->create_handler<GetScopeNotifySettingsQuery>(std::move(promise))->send(scope);
}
void MessagesManager::on_get_dialog_notification_settings_query_finished(DialogId dialog_id, Status &&status) {
auto it = get_dialog_notification_settings_queries_.find(dialog_id);
CHECK(it != get_dialog_notification_settings_queries_.end());
@ -21518,10 +21523,10 @@ void MessagesManager::load_notification_settings() {
return;
}
if (!users_notification_settings_.is_synchronized) {
td_->create_handler<GetScopeNotifySettingsQuery>(Promise<>())->send(NotificationSettingsScope::Private);
send_get_scope_notification_settings_query(NotificationSettingsScope::Private, Promise<>());
}
if (!chats_notification_settings_.is_synchronized) {
td_->create_handler<GetScopeNotifySettingsQuery>(Promise<>())->send(NotificationSettingsScope::Group);
send_get_scope_notification_settings_query(NotificationSettingsScope::Group, Promise<>());
}
}

View File

@ -642,6 +642,8 @@ class MessagesManager : public Actor {
void send_get_dialog_notification_settings_query(DialogId dialog_id, Promise<Unit> &&promise);
void send_get_scope_notification_settings_query(NotificationSettingsScope scope, Promise<Unit> &&promise);
void on_get_dialog_notification_settings_query_finished(DialogId dialog_id, Status &&status);
void on_get_dialog_query_finished(DialogId dialog_id, Status &&status);