Add userFullInfo.has_pinned_stories.
This commit is contained in:
parent
cc14dbb8a1
commit
7935fb183c
@ -750,12 +750,13 @@ botInfo short_description:string description:string photo:photo animation:animat
|
||||
//@has_private_calls True, if the user can't be called due to their privacy settings
|
||||
//@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings
|
||||
//@has_restricted_voice_and_video_note_messages True, if voice and video notes can't be sent or forwarded to the user
|
||||
//@has_pinned_stories True, if the user has pinned stories
|
||||
//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
|
||||
//@bio A short user bio; may be null for bots
|
||||
//@premium_gift_options The list of available options for gifting Telegram Premium to the user
|
||||
//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user
|
||||
//@bot_info For bots, information about the bot; may be null
|
||||
userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool need_phone_number_privacy_exception:Bool bio:formattedText premium_gift_options:vector<premiumPaymentOption> group_in_common_count:int32 bot_info:botInfo = UserFullInfo;
|
||||
userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool bio:formattedText premium_gift_options:vector<premiumPaymentOption> group_in_common_count:int32 bot_info:botInfo = UserFullInfo;
|
||||
|
||||
//@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers
|
||||
users total_count:int32 user_ids:vector<int53> = Users;
|
||||
|
@ -4682,6 +4682,7 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
|
||||
STORE_FLAG(voice_messages_forbidden);
|
||||
STORE_FLAG(has_personal_photo);
|
||||
STORE_FLAG(has_fallback_photo);
|
||||
STORE_FLAG(has_pinned_stories);
|
||||
END_STORE_FLAGS();
|
||||
if (has_about) {
|
||||
store(about, storer);
|
||||
@ -4764,6 +4765,7 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
|
||||
PARSE_FLAG(voice_messages_forbidden);
|
||||
PARSE_FLAG(has_personal_photo);
|
||||
PARSE_FLAG(has_fallback_photo);
|
||||
PARSE_FLAG(has_pinned_stories);
|
||||
END_PARSE_FLAGS();
|
||||
if (has_about) {
|
||||
parse(about, parser);
|
||||
@ -12517,13 +12519,14 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
|
||||
auto premium_gift_options = get_premium_gift_options(std::move(user->premium_gifts_));
|
||||
AdministratorRights group_administrator_rights(user->bot_group_admin_rights_, ChannelType::Megagroup);
|
||||
AdministratorRights broadcast_administrator_rights(user->bot_broadcast_admin_rights_, ChannelType::Broadcast);
|
||||
bool has_pinned_stories = user->stories_pinned_available_;
|
||||
if (user_full->can_be_called != can_be_called || user_full->supports_video_calls != supports_video_calls ||
|
||||
user_full->has_private_calls != has_private_calls ||
|
||||
user_full->group_administrator_rights != group_administrator_rights ||
|
||||
user_full->broadcast_administrator_rights != broadcast_administrator_rights ||
|
||||
user_full->premium_gift_options != premium_gift_options ||
|
||||
user_full->voice_messages_forbidden != voice_messages_forbidden ||
|
||||
user_full->can_pin_messages != can_pin_messages) {
|
||||
user_full->can_pin_messages != can_pin_messages || user_full->has_pinned_stories != has_pinned_stories) {
|
||||
user_full->can_be_called = can_be_called;
|
||||
user_full->supports_video_calls = supports_video_calls;
|
||||
user_full->has_private_calls = has_private_calls;
|
||||
@ -12532,6 +12535,7 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
|
||||
user_full->premium_gift_options = std::move(premium_gift_options);
|
||||
user_full->voice_messages_forbidden = voice_messages_forbidden;
|
||||
user_full->can_pin_messages = can_pin_messages;
|
||||
user_full->has_pinned_stories = has_pinned_stories;
|
||||
|
||||
user_full->is_changed = true;
|
||||
}
|
||||
@ -13637,6 +13641,21 @@ void ContactsManager::on_update_user_full_is_blocked(UserFull *user_full, UserId
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_user_has_pinned_stories(UserId user_id, bool has_pinned_stories) {
|
||||
if (!user_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive invalid " << user_id;
|
||||
return;
|
||||
}
|
||||
|
||||
UserFull *user_full = get_user_full_force(user_id);
|
||||
if (user_full == nullptr || user_full->has_pinned_stories == has_pinned_stories) {
|
||||
return;
|
||||
}
|
||||
user_full->has_pinned_stories = has_pinned_stories;
|
||||
user_full->is_changed = true;
|
||||
update_user_full(user_full, user_id, "on_update_user_has_pinned_stories");
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_user_common_chat_count(UserId user_id, int32 common_chat_count) {
|
||||
LOG(INFO) << "Receive " << common_chat_count << " common chat count with " << user_id;
|
||||
if (!user_id.is_valid()) {
|
||||
@ -14031,6 +14050,7 @@ void ContactsManager::drop_user_full(UserId user_id) {
|
||||
user_full->broadcast_administrator_rights = {};
|
||||
user_full->premium_gift_options.clear();
|
||||
user_full->voice_messages_forbidden = false;
|
||||
user_full->has_pinned_stories = false;
|
||||
user_full->is_changed = true;
|
||||
|
||||
update_user_full(user_full, user_id, "drop_user_full");
|
||||
@ -18888,7 +18908,7 @@ tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(U
|
||||
get_chat_photo_object(td_->file_manager_.get(), user_full->photo),
|
||||
get_chat_photo_object(td_->file_manager_.get(), user_full->fallback_photo), user_full->is_blocked,
|
||||
user_full->can_be_called, user_full->supports_video_calls, user_full->has_private_calls,
|
||||
!user_full->private_forward_name.empty(), voice_messages_forbidden,
|
||||
!user_full->private_forward_name.empty(), voice_messages_forbidden, user_full->has_pinned_stories,
|
||||
user_full->need_phone_number_privacy_exception, std::move(bio_object),
|
||||
get_premium_payment_options_object(user_full->premium_gift_options), user_full->common_chat_count,
|
||||
std::move(bot_info));
|
||||
|
@ -189,6 +189,7 @@ class ContactsManager final : public Actor {
|
||||
void on_update_user_online(UserId user_id, tl_object_ptr<telegram_api::UserStatus> &&status);
|
||||
void on_update_user_local_was_online(UserId user_id, int32 local_was_online);
|
||||
void on_update_user_is_blocked(UserId user_id, bool is_blocked);
|
||||
void on_update_user_has_pinned_stories(UserId user_id, bool has_pinned_stories);
|
||||
void on_update_user_common_chat_count(UserId user_id, int32 common_chat_count);
|
||||
void on_update_user_need_phone_number_privacy_exception(UserId user_id, bool need_phone_number_privacy_exception);
|
||||
|
||||
@ -848,6 +849,7 @@ class ContactsManager final : public Actor {
|
||||
bool can_pin_messages = true;
|
||||
bool need_phone_number_privacy_exception = false;
|
||||
bool voice_messages_forbidden = false;
|
||||
bool has_pinned_stories = false;
|
||||
|
||||
bool is_common_chat_count_changed = true;
|
||||
bool is_changed = true; // have new changes that need to be sent to the client and database
|
||||
|
@ -639,6 +639,9 @@ void StoryManager::on_get_dialog_pinned_stories(DialogId owner_dialog_id,
|
||||
Promise<td_api::object_ptr<td_api::stories>> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
auto result = on_get_stories(owner_dialog_id, {}, std::move(stories));
|
||||
if (owner_dialog_id.get_type() == DialogType::User) {
|
||||
td_->contacts_manager_->on_update_user_has_pinned_stories(owner_dialog_id.get_user_id(), result.first > 0);
|
||||
}
|
||||
promise.set_value(get_stories_object(result.first, transform(result.second, [owner_dialog_id](StoryId story_id) {
|
||||
return StoryFullId(owner_dialog_id, story_id);
|
||||
})));
|
||||
|
Loading…
Reference in New Issue
Block a user