From 0dc90cf8200f7e96a3273f164c8300c83c96fb99 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 13 Feb 2024 13:13:41 +0300 Subject: [PATCH] Remove chat identifier from setStoryPrivacySettings. --- td/generate/scheme/td_api.tl | 5 ++--- td/telegram/StoryManager.cpp | 3 ++- td/telegram/StoryManager.h | 4 ++-- td/telegram/Td.cpp | 4 ++-- td/telegram/cli.cpp | 5 ++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 198a8f7db..681b4e52e 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -8440,11 +8440,10 @@ sendStory chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption: //@caption New story caption; pass null to keep the current caption editStory story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; -//@description Changes privacy settings of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story +//@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story -setStoryPrivacySettings story_sender_chat_id:int53 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; +setStoryPrivacySettings story_id:int32 privacy_settings:StoryPrivacySettings = Ok; //@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true //@story_sender_chat_id Identifier of the chat that posted the story diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index a2f72ad66..a20788c6d 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -5263,9 +5263,10 @@ void StoryManager::delete_pending_story(FileId file_id, unique_ptr } } -void StoryManager::set_story_privacy_settings(DialogId owner_dialog_id, StoryId story_id, +void StoryManager::set_story_privacy_settings(StoryId story_id, td_api::object_ptr &&settings, Promise &&promise) { + DialogId owner_dialog_id(td_->dialog_manager_->get_my_dialog_id()); StoryFullId story_full_id{owner_dialog_id, story_id}; const Story *story = get_story(story_full_id); if (story == nullptr || story->content_ == nullptr) { diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index f630a5198..ab03f589b 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -227,8 +227,8 @@ class StoryManager final : public Actor { td_api::object_ptr &&input_areas, td_api::object_ptr &&input_caption, Promise &&promise); - void set_story_privacy_settings(DialogId owner_dialog_id, StoryId story_id, - td_api::object_ptr &&settings, Promise &&promise); + void set_story_privacy_settings(StoryId story_id, td_api::object_ptr &&settings, + Promise &&promise); void toggle_story_is_pinned(DialogId owner_dialog_id, StoryId story_id, bool is_pinned, Promise &&promise); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 67ca1d377..e3023bb82 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -5783,8 +5783,8 @@ void Td::on_request(uint64 id, td_api::editStory &request) { void Td::on_request(uint64 id, td_api::setStoryPrivacySettings &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - story_manager_->set_story_privacy_settings(DialogId(request.story_sender_chat_id_), StoryId(request.story_id_), - std::move(request.privacy_settings_), std::move(promise)); + story_manager_->set_story_privacy_settings(StoryId(request.story_id_), std::move(request.privacy_settings_), + std::move(promise)); } void Td::on_request(uint64 id, const td_api::toggleStoryIsPinned &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index cfab0372a..f27f3e6d6 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4441,11 +4441,10 @@ class CliClient final : public Actor { to_integers(sticker_file_ids), duration, false), areas, as_caption(caption))); } else if (op == "ssps") { - ChatId story_sender_chat_id; StoryId story_id; StoryPrivacySettings rules; - get_args(args, story_sender_chat_id, story_id, rules); - send_request(td_api::make_object(story_sender_chat_id, story_id, rules)); + get_args(args, story_id, rules); + send_request(td_api::make_object(story_id, rules)); } else if (op == "tsip") { ChatId story_sender_chat_id; StoryId story_id;