Pass promise to on_update_dialog_filters.

This commit is contained in:
levlam 2023-04-02 11:53:25 +03:00
parent 890084df51
commit 7085bc4d8f
3 changed files with 8 additions and 11 deletions

View File

@ -551,13 +551,13 @@ void DialogFilterManager::on_authorization_success() {
reload_dialog_filters();
}
void DialogFilterManager::on_update_dialog_filters() {
void DialogFilterManager::on_update_dialog_filters(Promise<Unit> &&promise) {
if (td_->auth_manager_->is_bot()) {
// just in case
return;
return promise.set_value(Unit());
}
schedule_dialog_filters_reload(0.0);
schedule_reload_dialog_filters(std::move(promise));
}
void DialogFilterManager::schedule_reload_dialog_filters(Promise<Unit> &&promise) {
@ -1049,7 +1049,7 @@ void DialogFilterManager::on_get_dialog_filters(
if (!G()->is_expected_error(r_filters.error())) {
LOG(WARNING) << "Receive error " << r_filters.error() << " for GetDialogFiltersQuery";
}
fail_promises(promises, r_filters.move_as_error());
set_promises(promises); // ignore error
need_dialog_filters_reload_ = false;
schedule_dialog_filters_reload(Random::fast(60, 5 * 60));
return;

View File

@ -34,7 +34,7 @@ class DialogFilterManager final : public Actor {
void on_authorization_success();
void on_update_dialog_filters();
void on_update_dialog_filters(Promise<Unit> &&promise);
void schedule_reload_dialog_filters(Promise<Unit> &&promise);

View File

@ -3659,18 +3659,15 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDialogUnreadMar
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDialogFilter> update, Promise<Unit> &&promise) {
td_->dialog_filter_manager_->on_update_dialog_filters();
promise.set_value(Unit());
td_->dialog_filter_manager_->on_update_dialog_filters(std::move(promise));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDialogFilters> update, Promise<Unit> &&promise) {
td_->dialog_filter_manager_->on_update_dialog_filters();
promise.set_value(Unit());
td_->dialog_filter_manager_->on_update_dialog_filters(std::move(promise));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDialogFilterOrder> update, Promise<Unit> &&promise) {
td_->dialog_filter_manager_->on_update_dialog_filters();
promise.set_value(Unit());
td_->dialog_filter_manager_->on_update_dialog_filters(std::move(promise));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDcOptions> update, Promise<Unit> &&promise) {