From 8d0627b0140765bc1824f055cff4601e5cfb9022 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 15 Aug 2023 19:39:59 +0300 Subject: [PATCH] Disallow story areas editing without content edit. --- td/generate/scheme/td_api.tl | 2 +- td/telegram/MessagesManager.cpp | 2 +- td/telegram/StoryManager.cpp | 3 +++ td/telegram/cli.cpp | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 1a995e8e0..57a3cd884 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -7460,7 +7460,7 @@ sendStory content:InputStoryContent areas:inputStoryAreas caption:formattedText //@description Changes content and caption of a previously sent story //@story_id Identifier of the story to edit //@content New content of the story; pass null to keep the current content -//@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas +//@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed //@caption New story caption; pass null to keep the current caption editStory story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 53cf52f84..3f508b517 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -3770,7 +3770,7 @@ class EditMessageQuery final : public Td::ResultHandler { } void on_error(Status status) final { - LOG(INFO) << "Receive error for EditMessage: " << status; + LOG(INFO) << "Receive error for EditMessageQuery: " << status; if (!td_->auth_manager_->is_bot() && status.message() == "MESSAGE_NOT_MODIFIED") { return promise_.set_value(0); } diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index b0324ae42..2128ada53 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -730,6 +730,7 @@ class StoryManager::SendStoryQuery final : public Td::ResultHandler { const auto *story = pending_story_->story_.get(); const StoryContent *content = story->content_.get(); + CHECK(input_file != nullptr); auto input_media = get_story_content_input_media(td_, content, std::move(input_file)); CHECK(input_media != nullptr); @@ -4191,6 +4192,8 @@ void StoryManager::edit_story(StoryId story_id, td_api::object_ptr() const { + if (areas.empty()) { + return nullptr; + } auto result = td_api::make_object(); for (const auto &area : full_split(areas, ';')) { if (area.empty()) {