Add MessagesManager::need_dialog_in_list.
GitOrigin-RevId: 9e1b6d98f9fd47c23a9af237c632809a145f7b58
This commit is contained in:
parent
a2339a1514
commit
c2ce25ee44
@ -28637,9 +28637,6 @@ int64 MessagesManager::get_dialog_private_order(const DialogList *list, const Di
|
|||||||
if (pinned_order != DEFAULT_ORDER) {
|
if (pinned_order != DEFAULT_ORDER) {
|
||||||
return pinned_order;
|
return pinned_order;
|
||||||
}
|
}
|
||||||
if (list->folder_id != d->folder_id) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return d->order;
|
return d->order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28854,7 +28851,7 @@ void MessagesManager::update_dialog_lists(Dialog *d,
|
|||||||
auto &list = dialog_list.second;
|
auto &list = dialog_list.second;
|
||||||
|
|
||||||
const DialogOrderInList &old_order = old_orders[dialog_list_id];
|
const DialogOrderInList &old_order = old_orders[dialog_list_id];
|
||||||
const DialogOrderInList new_order = get_dialog_order_in_list(&list, d);
|
const DialogOrderInList new_order = get_dialog_order_in_list(&list, d, true);
|
||||||
|
|
||||||
bool was_in_list = old_order.order != DEFAULT_ORDER && old_order.private_order != 0;
|
bool was_in_list = old_order.order != DEFAULT_ORDER && old_order.private_order != 0;
|
||||||
bool is_in_list = new_order.order != DEFAULT_ORDER && new_order.private_order != 0;
|
bool is_in_list = new_order.order != DEFAULT_ORDER && new_order.private_order != 0;
|
||||||
@ -29118,18 +29115,26 @@ MessagesManager::Dialog *MessagesManager::on_load_dialog_from_database(DialogId
|
|||||||
return add_new_dialog(parse_dialog(dialog_id, value), true);
|
return add_new_dialog(parse_dialog(dialog_id, value), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagesManager::DialogOrderInList MessagesManager::get_dialog_order_in_list(const DialogList *list,
|
bool MessagesManager::need_dialog_in_list(const DialogList &list, const Dialog *d) const {
|
||||||
const Dialog *d) const {
|
return d->folder_id == list.folder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessagesManager::DialogOrderInList MessagesManager::get_dialog_order_in_list(const DialogList *list, const Dialog *d,
|
||||||
|
bool actual) const {
|
||||||
CHECK(!td_->auth_manager_->is_bot());
|
CHECK(!td_->auth_manager_->is_bot());
|
||||||
CHECK(list != nullptr);
|
CHECK(list != nullptr);
|
||||||
CHECK(d != nullptr);
|
CHECK(d != nullptr);
|
||||||
DialogOrderInList order;
|
DialogOrderInList order;
|
||||||
order.order = d->order;
|
order.order = d->order;
|
||||||
order.private_order = get_dialog_private_order(list, d);
|
if (actual ? need_dialog_in_list(*list, d) : td::contains(d->dialog_list_ids, list->folder_id)) {
|
||||||
order.public_order =
|
order.private_order = get_dialog_private_order(list, d);
|
||||||
DialogDate(order.private_order, d->dialog_id) <= list->last_dialog_date_ ? order.private_order : 0;
|
}
|
||||||
order.is_pinned = get_dialog_pinned_order(list, d->dialog_id) != DEFAULT_ORDER;
|
if (order.private_order != 0) {
|
||||||
order.is_sponsored = order.private_order != 0 && is_dialog_sponsored(d);
|
order.public_order =
|
||||||
|
DialogDate(order.private_order, d->dialog_id) <= list->last_dialog_date_ ? order.private_order : 0;
|
||||||
|
order.is_pinned = get_dialog_pinned_order(list, d->dialog_id) != DEFAULT_ORDER;
|
||||||
|
order.is_sponsored = is_dialog_sponsored(d);
|
||||||
|
}
|
||||||
order.total_dialog_count = get_dialog_total_count(*list);
|
order.total_dialog_count = get_dialog_total_count(*list);
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
@ -2176,7 +2176,9 @@ class MessagesManager : public Actor {
|
|||||||
void update_dialogs_hints(const Dialog *d);
|
void update_dialogs_hints(const Dialog *d);
|
||||||
void update_dialogs_hints_rating(const Dialog *d);
|
void update_dialogs_hints_rating(const Dialog *d);
|
||||||
|
|
||||||
DialogOrderInList get_dialog_order_in_list(const DialogList *list, const Dialog *d) const;
|
bool need_dialog_in_list(const DialogList &list, const Dialog *d) const;
|
||||||
|
|
||||||
|
DialogOrderInList get_dialog_order_in_list(const DialogList *list, const Dialog *d, bool actual = false) const;
|
||||||
|
|
||||||
std::unordered_map<FolderId, DialogOrderInList, FolderIdHash> get_dialog_orders(const Dialog *d) const;
|
std::unordered_map<FolderId, DialogOrderInList, FolderIdHash> get_dialog_orders(const Dialog *d) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user