Improve td_api::toggleChatStoriesAreHidden and remove User.stories_are_hidden.

This commit is contained in:
levlam 2023-06-27 22:40:34 +03:00
parent d3e0372b14
commit 5e9d98abce
5 changed files with 13 additions and 15 deletions

View File

@ -714,12 +714,11 @@ usernames active_usernames:vector<string> disabled_usernames:vector<string> edit
//@is_scam True, if many users reported this user as a scam
//@is_fake True, if many users reported this user as a fake account
//@has_active_stories True, if the user has non-expired stories available to the current user
//@stories_are_hidden True, if stories of the user aren't available on the main chat list
//@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method
//@type Type of the user
//@language_code IETF language tag of the user's language; only available to bots
//@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots
user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool stories_are_hidden:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User;
user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User;
//@description Contains information about a bot
@ -7269,8 +7268,8 @@ 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 Toggles whether stories of the user are available on the main chat list @user_id Identifier of the user @are_hidden Pass true to make the story unavailable from the main chat list; pass false to make them available
toggleUserStoriesAreHidden user_id:int53 are_hidden:Bool = Ok;
//@description Toggles whether stories posted by the chat are available on the main chat list @chat_id Identifier of the chat @are_hidden Pass true to make the story unavailable from the main chat list; pass false to make them available
toggleChatStoriesAreHidden chat_id:int53 are_hidden:Bool = Ok;
//@description Returns the list of active stories of a given user. The stories are returned in a chronological order (i.e., in order of increasing story_id) @user_id User identifier
getUserActiveStories user_id:int53 = ActiveStories;

View File

@ -13459,7 +13459,7 @@ void ContactsManager::on_update_user_stories_hidden(User *u, UserId user_id, boo
if (u->stories_hidden != stories_hidden) {
LOG(DEBUG) << "Change stories are archived of " << user_id << " to " << stories_hidden;
u->stories_hidden = stories_hidden;
u->is_changed = true;
u->need_save_to_database = true;
}
}
@ -18789,7 +18789,7 @@ td_api::object_ptr<td_api::updateUser> ContactsManager::get_update_unknown_user_
auto have_access = user_id == get_my_id() || user_messages_.count(user_id) != 0;
return td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
user_id.get(), "", "", nullptr, "", td_api::make_object<td_api::userStatusEmpty>(), nullptr, nullptr, false,
false, false, false, false, false, "", false, false, false, false, have_access,
false, false, false, false, false, "", false, false, false, have_access,
td_api::make_object<td_api::userTypeUnknown>(), "", false));
}
@ -18828,7 +18828,7 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
get_user_status_object(user_id, u), get_profile_photo_object(td_->file_manager_.get(), u->photo),
std::move(emoji_status), u->is_contact, u->is_mutual_contact, u->is_close_friend, u->is_verified, u->is_premium,
u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake, u->has_stories,
u->stories_hidden, have_access, std::move(type), u->language_code, u->attach_menu_enabled);
have_access, std::move(type), u->language_code, u->attach_menu_enabled);
}
vector<int64> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids, const char *source) const {

View File

@ -5660,11 +5660,10 @@ void Td::on_request(uint64 id, const td_api::deleteStory &request) {
story_manager_->delete_story(StoryId(request.story_id_), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleUserStoriesAreHidden &request) {
void Td::on_request(uint64 id, const td_api::toggleChatStoriesAreHidden &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
story_manager_->toggle_dialog_stories_hidden(DialogId(UserId(request.user_id_)), request.are_hidden_,
std::move(promise));
story_manager_->toggle_dialog_stories_hidden(DialogId(request.chat_id_), request.are_hidden_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getForumTopicDefaultIcons &request) {

View File

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

View File

@ -4040,11 +4040,11 @@ class CliClient final : public Actor {
StoryId story_id;
get_args(args, story_id);
send_request(td_api::make_object<td_api::deleteStory>(story_id));
} else if (op == "tusah") {
UserId user_id;
} else if (op == "tcsah") {
ChatId chat_id;
bool are_hidden;
get_args(args, user_id, are_hidden);
send_request(td_api::make_object<td_api::toggleUserStoriesAreHidden>(user_id, are_hidden));
get_args(args, chat_id, are_hidden);
send_request(td_api::make_object<td_api::toggleChatStoriesAreHidden>(chat_id, are_hidden));
} else if (op == "gups") {
UserId user_id;
StoryId from_story_id;