Reload filters to repair their order if the server added new filter to the beginning of the list.

GitOrigin-RevId: 4d515573077bae07dba6aa28640f3c5038033fb2
This commit is contained in:
levlam 2020-06-01 00:28:38 +03:00
parent e9779f8f4f
commit 5fca85a334

View File

@ -14453,8 +14453,10 @@ void MessagesManager::on_get_dialog_filters(Result<vector<tl_object_ptr<telegram
schedule_dialog_filters_reload(get_dialog_filters_cache_time()); schedule_dialog_filters_reload(get_dialog_filters_cache_time());
save_dialog_filters(); save_dialog_filters();
if (need_synchronize_dialog_filters()) {
synchronize_dialog_filters(); synchronize_dialog_filters();
} }
}
bool MessagesManager::need_synchronize_dialog_filters() const { bool MessagesManager::need_synchronize_dialog_filters() const {
size_t server_dialog_filter_count = 0; size_t server_dialog_filter_count = 0;
@ -14494,7 +14496,8 @@ void MessagesManager::synchronize_dialog_filters() {
return reload_dialog_filters(); return reload_dialog_filters();
} }
if (!need_synchronize_dialog_filters()) { if (!need_synchronize_dialog_filters()) {
return; // reload filters to repair their order if the server added new filter to the beginning of the list
return reload_dialog_filters();
} }
LOG(INFO) << "Synchronize chat filter changes with server having local " << get_dialog_filter_ids(dialog_filters_) LOG(INFO) << "Synchronize chat filter changes with server having local " << get_dialog_filter_ids(dialog_filters_)