diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 3e20e2d3c..bad036b79 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -882,12 +882,9 @@ StoryId StoryManager::on_get_story(DialogId owner_dialog_id, } CHECK(story_item_ptr != nullptr); switch (story_item_ptr->get_id()) { - case telegram_api::storyItemDeleted::ID: { - auto story_item = telegram_api::move_object_as(story_item_ptr); - StoryId story_id(story_item->id_); - on_delete_story(owner_dialog_id, story_id); - return story_id; - } + case telegram_api::storyItemDeleted::ID: + return on_get_deleted_story(owner_dialog_id, + telegram_api::move_object_as(story_item_ptr)); case telegram_api::storyItemSkipped::ID: LOG(ERROR) << "Receive " << to_string(story_item_ptr); return {}; @@ -1027,6 +1024,13 @@ StoryId StoryManager::on_get_skipped_story(DialogId owner_dialog_id, return story_id; } +StoryId StoryManager::on_get_deleted_story(DialogId owner_dialog_id, + telegram_api::object_ptr &&story_item) { + StoryId story_id(story_item->id_); + on_delete_story(owner_dialog_id, story_id); + return story_id; +} + void StoryManager::on_delete_story(DialogId owner_dialog_id, StoryId story_id) { if (!story_id.is_server()) { LOG(ERROR) << "Receive deleted " << story_id << " in " << owner_dialog_id; @@ -1088,7 +1092,7 @@ std::pair> StoryManager::on_get_stories( for (auto &story : stories->stories_) { switch (story->get_id()) { case telegram_api::storyItemDeleted::ID: - LOG(ERROR) << "Receive " << to_string(story); + on_get_deleted_story(owner_dialog_id, telegram_api::move_object_as(story)); break; case telegram_api::storyItemSkipped::ID: LOG(ERROR) << "Receive " << to_string(story); @@ -1154,7 +1158,7 @@ StoryManager::ActiveStories StoryManager::on_get_user_stories( for (auto &story : user_stories->stories_) { switch (story->get_id()) { case telegram_api::storyItemDeleted::ID: - LOG(ERROR) << "Receive " << to_string(story); + on_get_deleted_story(owner_dialog_id, telegram_api::move_object_as(story)); break; case telegram_api::storyItemSkipped::ID: { auto story_id = diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index fa5552c43..4de5cb958 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -179,6 +179,9 @@ class StoryManager final : public Actor { StoryId on_get_skipped_story(DialogId owner_dialog_id, telegram_api::object_ptr &&story_item); + StoryId on_get_deleted_story(DialogId owner_dialog_id, + telegram_api::object_ptr &&story_item); + void on_delete_story(DialogId owner_dialog_id, StoryId story_id); ActiveStories on_get_user_stories(DialogId owner_dialog_id,