Disallow story areas editing without content edit.
This commit is contained in:
parent
cde095db6c
commit
8d0627b014
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<td_api::Input
|
||||
}
|
||||
if (*current_areas == areas) {
|
||||
are_media_areas_edited = false;
|
||||
} else if (content == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Can't edit story areas without content"));
|
||||
}
|
||||
}
|
||||
if (is_caption_edited) {
|
||||
|
@ -1207,6 +1207,9 @@ class CliClient final : public Actor {
|
||||
string areas;
|
||||
|
||||
operator td_api::object_ptr<td_api::inputStoryAreas>() const {
|
||||
if (areas.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto result = td_api::make_object<td_api::inputStoryAreas>();
|
||||
for (const auto &area : full_split(areas, ';')) {
|
||||
if (area.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user