Fix loading empty list of pinned chats from binlog.

GitOrigin-RevId: 21f90fe3f9f869fe4b4fdab228a5bae1975728ae
This commit is contained in:
levlam 2020-06-16 15:21:37 +03:00
parent 8eadeaf7b3
commit 96b18f3ad8

View File

@ -10888,18 +10888,17 @@ void MessagesManager::init() {
auto *list = get_dialog_list(DialogListId(folder_id));
CHECK(list != nullptr);
CHECK(list->pinned_dialogs_.empty());
if (!r_dialog_ids.empty()) {
for (auto &r_dialog_id : reversed(r_dialog_ids)) {
auto dialog_id = r_dialog_id.move_as_ok();
auto order = get_next_pinned_dialog_order();
list->pinned_dialogs_.emplace_back(order, dialog_id);
list->pinned_dialog_id_orders_.emplace(dialog_id, order);
}
std::reverse(list->pinned_dialogs_.begin(), list->pinned_dialogs_.end());
list->are_pinned_dialogs_inited_ = true;
update_list_last_pinned_dialog_date(*list);
for (auto &r_dialog_id : reversed(r_dialog_ids)) {
auto dialog_id = r_dialog_id.move_as_ok();
auto order = get_next_pinned_dialog_order();
list->pinned_dialogs_.emplace_back(order, dialog_id);
list->pinned_dialog_id_orders_.emplace(dialog_id, order);
}
std::reverse(list->pinned_dialogs_.begin(), list->pinned_dialogs_.end());
list->are_pinned_dialogs_inited_ = true;
update_list_last_pinned_dialog_date(*list);
LOG(INFO) << "Loaded pinned chats " << list->pinned_dialogs_ << " in " << folder_id;
}
}