Ensure that story_list.list_last_story_date_ never decrease.
This commit is contained in:
parent
b7551dab33
commit
689960ddcb
@ -1344,12 +1344,14 @@ void StoryManager::load_active_stories(StoryListId story_list_id, Promise<Unit>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!story_list.server_has_more_) {
|
if (!story_list.server_has_more_) {
|
||||||
|
if (story_list.list_last_story_date_ != MAX_DIALOG_DATE) {
|
||||||
auto min_story_date = story_list.list_last_story_date_;
|
auto min_story_date = story_list.list_last_story_date_;
|
||||||
story_list.list_last_story_date_ = MAX_DIALOG_DATE;
|
story_list.list_last_story_date_ = MAX_DIALOG_DATE;
|
||||||
for (auto it = story_list.ordered_stories_.upper_bound(min_story_date); it != story_list.ordered_stories_.end();
|
for (auto it = story_list.ordered_stories_.upper_bound(min_story_date); it != story_list.ordered_stories_.end();
|
||||||
++it) {
|
++it) {
|
||||||
on_dialog_active_stories_order_updated(it->get_dialog_id(), "load_active_stories");
|
on_dialog_active_stories_order_updated(it->get_dialog_id(), "load_active_stories");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return promise.set_error(Status::Error(404, "Not found"));
|
return promise.set_error(Status::Error(404, "Not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1392,9 +1394,10 @@ void StoryManager::on_load_active_stories_from_database(StoryListId story_list_i
|
|||||||
if (story_list.last_loaded_database_dialog_date_ < max_story_date) {
|
if (story_list.last_loaded_database_dialog_date_ < max_story_date) {
|
||||||
story_list.last_loaded_database_dialog_date_ = max_story_date;
|
story_list.last_loaded_database_dialog_date_ = max_story_date;
|
||||||
|
|
||||||
|
if (story_list.list_last_story_date_ < max_story_date) {
|
||||||
auto min_story_date = story_list.list_last_story_date_;
|
auto min_story_date = story_list.list_last_story_date_;
|
||||||
story_list.list_last_story_date_ = max_story_date;
|
story_list.list_last_story_date_ = max_story_date;
|
||||||
auto &owner_dialog_ids = dependencies.get_dialog_ids();
|
const auto &owner_dialog_ids = dependencies.get_dialog_ids();
|
||||||
for (auto it = story_list.ordered_stories_.upper_bound(min_story_date);
|
for (auto it = story_list.ordered_stories_.upper_bound(min_story_date);
|
||||||
it != story_list.ordered_stories_.end() && *it <= max_story_date; ++it) {
|
it != story_list.ordered_stories_.end() && *it <= max_story_date; ++it) {
|
||||||
auto dialog_id = it->get_dialog_id();
|
auto dialog_id = it->get_dialog_id();
|
||||||
@ -1405,6 +1408,7 @@ void StoryManager::on_load_active_stories_from_database(StoryListId story_list_i
|
|||||||
for (auto owner_dialog_id : owner_dialog_ids) {
|
for (auto owner_dialog_id : owner_dialog_ids) {
|
||||||
on_dialog_active_stories_order_updated(owner_dialog_id, "on_load_active_stories_from_database 2");
|
on_dialog_active_stories_order_updated(owner_dialog_id, "on_load_active_stories_from_database 2");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Last database story date didn't increase";
|
LOG(ERROR) << "Last database story date didn't increase";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user