Add supergroup.has_sensitive_content.

This commit is contained in:
levlam 2024-08-13 21:08:08 +03:00
parent f3f6f084d9
commit 843dff97a6
4 changed files with 12 additions and 4 deletions

View File

@ -1354,12 +1354,13 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb
//@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members
//@is_forum True, if the supergroup is a forum with topics
//@is_verified True, if the supergroup or channel is verified
//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted
//@is_scam True, if many users reported this supergroup or channel as a scam
//@is_fake True, if many users reported this supergroup or channel as a fake account
//@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user
//@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user
supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup;
supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool is_verified:Bool has_sensitive_content:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool = Supergroup;
//@description Contains full information about a supergroup or channel
//@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo

View File

@ -8851,8 +8851,8 @@ td_api::object_ptr<td_api::updateSupergroup> ChatManager::get_update_unknown_sup
bool is_megagroup = min_channel == nullptr ? false : min_channel->is_megagroup_;
return td_api::make_object<td_api::updateSupergroup>(td_api::make_object<td_api::supergroup>(
channel_id.get(), nullptr, 0, DialogParticipantStatus::Banned(0).get_chat_member_status_object(), 0, 0, false,
false, false, false, !is_megagroup, false, false, !is_megagroup, false, false, false, string(), false, false,
false, false));
false, false, false, !is_megagroup, false, false, !is_megagroup, false, false, false, false, string(), false,
false, false, false));
}
int64 ChatManager::get_supergroup_id_object(ChannelId channel_id, const char *source) const {
@ -8891,7 +8891,8 @@ tl_object_ptr<td_api::supergroup> ChatManager::get_supergroup_object(ChannelId c
get_channel_status(c).get_chat_member_status_object(), c->participant_count, c->boost_level,
c->has_linked_channel, c->has_location, c->sign_messages, c->show_message_sender, get_channel_join_to_send(c),
get_channel_join_request(c), c->is_slow_mode_enabled, !c->is_megagroup, c->is_gigagroup, c->is_forum,
c->is_verified, get_restriction_reason_description(c->restriction_reasons), c->is_scam, c->is_fake,
c->is_verified, get_restriction_reason_has_sensitive_content(c->restriction_reasons),
get_restriction_reason_description(c->restriction_reasons), c->is_scam, c->is_fake,
c->max_active_story_id.is_valid(), get_channel_has_unread_stories(c));
}

View File

@ -74,6 +74,10 @@ const RestrictionReason *get_restriction_reason(const vector<RestrictionReason>
return nullptr;
}
bool get_restriction_reason_has_sensitive_content(const vector<RestrictionReason> &restriction_reasons) {
return get_restriction_reason(restriction_reasons, true) != nullptr;
}
string get_restriction_reason_description(const vector<RestrictionReason> &restriction_reasons) {
const auto *restriction_reason = get_restriction_reason(restriction_reasons, false);
if (restriction_reason == nullptr) {

View File

@ -67,6 +67,8 @@ inline bool operator!=(const RestrictionReason &lhs, const RestrictionReason &rh
return !(lhs == rhs);
}
bool get_restriction_reason_has_sensitive_content(const vector<RestrictionReason> &restriction_reasons);
string get_restriction_reason_description(const vector<RestrictionReason> &restriction_reasons);
vector<RestrictionReason> get_restriction_reasons(Slice legacy_restriction_reason);