Allow to call update_list_last_dialog_date without sending updates.

GitOrigin-RevId: 82db046228cbfb5d1d78d20be8050896547eca77
This commit is contained in:
levlam 2020-05-27 23:40:03 +03:00
parent 22f158ac1f
commit dcaa9f3fba
2 changed files with 9 additions and 5 deletions

View File

@ -30358,7 +30358,7 @@ void MessagesManager::update_last_dialog_date(FolderId folder_id) {
} }
} }
void MessagesManager::update_list_last_pinned_dialog_date(DialogList &list) { void MessagesManager::update_list_last_pinned_dialog_date(DialogList &list, bool only_update) {
if (list.last_pinned_dialog_date_ == MAX_DIALOG_DATE) { if (list.last_pinned_dialog_date_ == MAX_DIALOG_DATE) {
return; return;
} }
@ -30376,11 +30376,11 @@ void MessagesManager::update_list_last_pinned_dialog_date(DialogList &list) {
} }
if (list.last_pinned_dialog_date_ < max_dialog_date) { if (list.last_pinned_dialog_date_ < max_dialog_date) {
list.last_pinned_dialog_date_ = max_dialog_date; list.last_pinned_dialog_date_ = max_dialog_date;
update_list_last_dialog_date(list); update_list_last_dialog_date(list, only_update);
} }
} }
void MessagesManager::update_list_last_dialog_date(DialogList &list) { void MessagesManager::update_list_last_dialog_date(DialogList &list, bool only_update) {
auto new_last_dialog_date = list.last_pinned_dialog_date_; auto new_last_dialog_date = list.last_pinned_dialog_date_;
for (auto folder_id : get_dialog_list_folder_ids(list)) { for (auto folder_id : get_dialog_list_folder_ids(list)) {
const auto &folder = *get_dialog_folder(folder_id); const auto &folder = *get_dialog_folder(folder_id);
@ -30394,6 +30394,10 @@ void MessagesManager::update_list_last_dialog_date(DialogList &list) {
CHECK(old_last_dialog_date < new_last_dialog_date); CHECK(old_last_dialog_date < new_last_dialog_date);
list.list_last_dialog_date_ = new_last_dialog_date; list.list_last_dialog_date_ = new_last_dialog_date;
if (only_update) {
return;
}
for (auto it = std::upper_bound(list.pinned_dialogs_.begin(), list.pinned_dialogs_.end(), old_last_dialog_date); for (auto it = std::upper_bound(list.pinned_dialogs_.begin(), list.pinned_dialogs_.end(), old_last_dialog_date);
it != list.pinned_dialogs_.end() && *it <= list.list_last_dialog_date_; ++it) { it != list.pinned_dialogs_.end() && *it <= list.list_last_dialog_date_; ++it) {
auto dialog_id = it->get_dialog_id(); auto dialog_id = it->get_dialog_id();

View File

@ -2497,9 +2497,9 @@ class MessagesManager : public Actor {
void update_last_dialog_date(FolderId folder_id); void update_last_dialog_date(FolderId folder_id);
void update_list_last_pinned_dialog_date(DialogList &list); void update_list_last_pinned_dialog_date(DialogList &list, bool only_update = false);
void update_list_last_dialog_date(DialogList &list); void update_list_last_dialog_date(DialogList &list, bool only_update = false);
void load_notification_settings(); void load_notification_settings();