diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 32c0e4384..976d7c7ad 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -964,6 +964,10 @@ void StoryManager::open_story(DialogId owner_dialog_id, StoryId story_id, Promis return promise.set_value(Unit()); } + if (story_id.is_server() && story->receive_date_ < G()->unix_time() - OPENED_STORY_POLL_PERIOD) { + reload_story(story_full_id, Auto()); + } + for (auto file_id : get_story_file_ids(story)) { td_->file_manager_->check_local_location_async(file_id, true); } @@ -1458,6 +1462,8 @@ StoryId StoryManager::on_get_story(DialogId owner_dialog_id, } CHECK(story != nullptr); + story->receive_date_ = G()->unix_time(); + bool is_bot = td_->auth_manager_->is_bot(); auto caption = get_message_text(td_->contacts_manager_.get(), std::move(story_item->caption_), std::move(story_item->entities_), diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index 032077e75..b5ef296b6 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -42,6 +42,7 @@ class StoryManager final : public Actor { struct Story { int32 date_ = 0; int32 expire_date_ = 0; + int32 receive_date_ = 0; bool is_pinned_ = false; bool is_public_ = false; bool is_for_close_friends_ = false; @@ -188,6 +189,8 @@ class StoryManager final : public Actor { class DeleteStoryOnServerLogEvent; class ReadStoriesOnServerLogEvent; + static constexpr int32 OPENED_STORY_POLL_PERIOD = 60; + void start_up() final; void tear_down() final;