diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index cc012d240..d4d400d9f 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -1278,6 +1278,10 @@ td_api::object_ptr StoryManager::get_update_st story_list.sent_total_count_); } +void StoryManager::update_story_list_sent_total_count(StoryListId story_list_id) { + update_story_list_sent_total_count(story_list_id, story_lists_[story_list_id == StoryListId::archive()]); +} + void StoryManager::update_story_list_sent_total_count(StoryListId story_list_id, StoryList &story_list) { if (story_list.list_last_story_date_ == MIN_DIALOG_DATE || story_list.server_total_count_ == -1) { return; @@ -2538,8 +2542,7 @@ void StoryManager::on_update_active_stories(DialogId owner_dialog_id, StoryId ma LOG(INFO) << "Delete active stories for " << owner_dialog_id; if (active_stories->story_list_id_.is_valid()) { delete_active_stories_from_story_list(owner_dialog_id, active_stories); - update_story_list_sent_total_count(active_stories->story_list_id_, - story_lists_[active_stories->story_list_id_ == StoryListId::archive()]); + update_story_list_sent_total_count(active_stories->story_list_id_); } active_stories_.erase(owner_dialog_id); send_update_chat_active_stories(owner_dialog_id); @@ -2622,15 +2625,13 @@ bool StoryManager::update_active_stories_order(DialogId owner_dialog_id, ActiveS CHECK(is_inserted); if (active_stories->story_list_id_ != story_list_id) { - update_story_list_sent_total_count(active_stories->story_list_id_, - story_lists_[active_stories->story_list_id_ == StoryListId::archive()]); + update_story_list_sent_total_count(active_stories->story_list_id_); } update_story_list_sent_total_count(story_list_id, story_list); } } else if (active_stories->story_list_id_.is_valid()) { delete_active_stories_from_story_list(owner_dialog_id, active_stories); - update_story_list_sent_total_count(active_stories->story_list_id_, - story_lists_[active_stories->story_list_id_ == StoryListId::archive()]); + update_story_list_sent_total_count(active_stories->story_list_id_); } if (active_stories->private_order_ != new_private_order || active_stories->public_order_ != new_public_order || diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index 8c15e9985..8dd4eac66 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -360,6 +360,8 @@ class StoryManager final : public Actor { td_api::object_ptr get_update_story_list_chat_count_object( StoryListId story_list_id, const StoryList &story_list) const; + void update_story_list_sent_total_count(StoryListId story_list_id); + void update_story_list_sent_total_count(StoryListId story_list_id, StoryList &story_list); vector get_story_file_ids(const Story *story) const;