Improve method setChatActiveStoriesList name.

This commit is contained in:
levlam 2023-07-08 16:53:29 +03:00
parent c6e5506f9a
commit 39b84d89ea
6 changed files with 23 additions and 15 deletions

View File

@ -7286,16 +7286,16 @@ toggleStoryIsPinned story_id:int32 is_pinned:Bool = Ok;
//@description Deletes a previously sent story @story_id Identifier of the story to delete
deleteStory story_id:int32 = Ok;
//@description Returns list of chats with non-default notification settings for stories
getStoryNotificationSettingsExceptions = Chats;
//@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by
//-the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded
//@story_list The story list in which to load active stories
loadActiveStories story_list:StoryList = Ok;
//@description Toggles whether stories posted by the chat are available above chat lists @chat_id Identifier of the chat that posted stories @are_hidden Pass true to make the stories unavailable above the chat lists; pass false to make them available
toggleChatStoriesAreHidden chat_id:int53 are_hidden:Bool = Ok;
//@description Returns list of chats with non-default notification settings for stories
getStoryNotificationSettingsExceptions = Chats;
//@description Changes story list in which stories from the chat are shown @chat_id Identifier of the chat that posted stories @story_list New list for active stories posted by the chat
setChatActiveStoriesList chat_id:int53 story_list:StoryList = Ok;
//@description Returns the list of active stories posted by the given chat @chat_id Chat identifier
getChatActiveStories chat_id:int53 = ChatActiveStories;

View File

@ -1167,7 +1167,8 @@ void StoryManager::on_synchronized_archive_all_stories(bool set_archive_all_stor
}
}
void StoryManager::toggle_dialog_stories_hidden(DialogId dialog_id, bool are_hidden, Promise<Unit> &&promise) {
void StoryManager::toggle_dialog_stories_hidden(DialogId dialog_id, StoryListId story_list_id,
Promise<Unit> &&promise) {
if (!td_->messages_manager_->have_dialog_force(dialog_id, "toggle_dialog_stories_hidden")) {
return promise.set_error(Status::Error(400, "Story sender not found"));
}
@ -1177,8 +1178,15 @@ void StoryManager::toggle_dialog_stories_hidden(DialogId dialog_id, bool are_hid
if (dialog_id.get_type() != DialogType::User) {
return promise.set_error(Status::Error(400, "Can't archive sender stories"));
}
if (story_list_id == get_dialog_story_list_id(dialog_id)) {
return promise.set_value(Unit());
}
if (!story_list_id.is_valid()) {
return promise.set_error(Status::Error(400, "Story list must not be empty"));
}
td_->create_handler<ToggleStoriesHiddenQuery>(std::move(promise))->send(dialog_id.get_user_id(), are_hidden);
td_->create_handler<ToggleStoriesHiddenQuery>(std::move(promise))
->send(dialog_id.get_user_id(), story_list_id == StoryListId::archive());
}
void StoryManager::get_dialog_pinned_stories(DialogId owner_dialog_id, StoryId from_story_id, int32 limit,

View File

@ -161,7 +161,7 @@ class StoryManager final : public Actor {
void reload_all_read_stories();
void toggle_dialog_stories_hidden(DialogId dialog_id, bool are_hidden, Promise<Unit> &&promise);
void toggle_dialog_stories_hidden(DialogId dialog_id, StoryListId story_list_id, Promise<Unit> &&promise);
void get_dialog_pinned_stories(DialogId owner_dialog_id, StoryId from_story_id, int32 limit,
Promise<td_api::object_ptr<td_api::stories>> &&promise);

View File

@ -5669,10 +5669,11 @@ void Td::on_request(uint64 id, const td_api::loadActiveStories &request) {
story_manager_->load_active_stories(StoryListId(request.story_list_), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleChatStoriesAreHidden &request) {
void Td::on_request(uint64 id, const td_api::setChatActiveStoriesList &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
story_manager_->toggle_dialog_stories_hidden(DialogId(request.chat_id_), request.are_hidden_, std::move(promise));
story_manager_->toggle_dialog_stories_hidden(DialogId(request.chat_id_), StoryListId(request.story_list_),
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getForumTopicDefaultIcons &request) {

View File

@ -800,7 +800,7 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::loadActiveStories &request);
void on_request(uint64 id, const td_api::toggleChatStoriesAreHidden &request);
void on_request(uint64 id, const td_api::setChatActiveStoriesList &request);
void on_request(uint64 id, const td_api::getForumTopicDefaultIcons &request);

View File

@ -4056,11 +4056,10 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::deleteStory>(story_id));
} else if (op == "las" || op == "lasa" || op == "lase") {
send_request(td_api::make_object<td_api::loadActiveStories>(as_story_list(op)));
} else if (op == "tcsah") {
} else if (op == "scasl" || op == "scasla" || op == "scasle") {
ChatId chat_id;
bool are_hidden;
get_args(args, chat_id, are_hidden);
send_request(td_api::make_object<td_api::toggleChatStoriesAreHidden>(chat_id, are_hidden));
get_args(args, chat_id);
send_request(td_api::make_object<td_api::setChatActiveStoriesList>(chat_id, as_story_list(op)));
} else if (op == "gcps") {
ChatId chat_id;
StoryId from_story_id;