From b9672dbf9735ea646f61dd136f10d7f72bcb3cfc Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 10 Jul 2023 14:14:12 +0300 Subject: [PATCH] Don't create stories without content. --- td/telegram/StoryManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 95eb60933..0dfe59798 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -1984,6 +1984,15 @@ StoryId StoryManager::on_get_new_story(DialogId owner_dialog_id, td_->messages_manager_->force_create_dialog(owner_dialog_id, "on_get_new_story"); + 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_), + true, is_bot, story_item->date_, false, "on_get_new_story"); + auto content = get_story_content(td_, std::move(story_item->media_), owner_dialog_id); + if (content == nullptr) { + return StoryId(); + } + Story *story = get_story_editable(story_full_id); bool is_changed = false; bool need_save_to_database = false; @@ -2004,15 +2013,6 @@ StoryId StoryManager::on_get_new_story(DialogId owner_dialog_id, 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_), - true, is_bot, story_item->date_, false, "on_get_new_story"); - auto content = get_story_content(td_, std::move(story_item->media_), owner_dialog_id); - if (content == nullptr) { - return StoryId(); - } - const BeingEditedStory *edited_story = nullptr; auto it = being_edited_stories_.find(story_full_id); if (it != being_edited_stories_.end()) {