Add promoted dialog to dialog list.

GitOrigin-RevId: db6936972df14739081b288cb270dc1560e46c61
This commit is contained in:
levlam 2018-05-10 21:26:46 +03:00
parent 1492467ab8
commit fa99ec2875

View File

@ -24270,12 +24270,15 @@ void MessagesManager::update_dialog_pos(Dialog *d, bool remove_from_dialog_list,
}
}
}
if (new_order == DEFAULT_ORDER && !d->is_empty) {
if (d->dialog_id != promoted_dialog_id_ && new_order == DEFAULT_ORDER && !d->is_empty) {
// if there is no known messages in the dialog, just leave it where it is
LOG(INFO) << "There is no known messages in the dialog";
return;
}
}
if (new_order == DEFAULT_ORDER && d->dialog_id == promoted_dialog_id_) {
new_order = static_cast<int64>(2147483647) << 32;
}
if (set_dialog_order(d, new_order, need_send_update_chat_order)) {
on_dialog_updated(d->dialog_id, "update_dialog_pos");
@ -25879,14 +25882,20 @@ void MessagesManager::set_promoted_dialog_id(DialogId dialog_id) {
return;
}
promoted_dialog_id_ = dialog_id;
if (promoted_dialog_id_.is_valid()) {
Dialog *d = get_dialog(promoted_dialog_id_);
CHECK(d != nullptr);
promoted_dialog_id_ = DialogId();
update_dialog_pos(d, false, "delete_promoted_dialog_id");
}
if (dialog_id.is_valid()) {
force_create_dialog(dialog_id, "set_promoted_dialog_id");
/*
Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr);
promoted_dialog_id_ = dialog_id;
update_dialog_pos(d, false, "set_promoted_dialog_id");
*/
}
if (G()->parameters().use_message_db) {