Adjust new chat member status for Bot API backward compatibility.
GitOrigin-RevId: 04bbe38639bde8c7ab0b8bc527b8df833d496c81
This commit is contained in:
parent
2f39a42441
commit
527c88ca88
@ -4394,10 +4394,21 @@ void ContactsManager::change_channel_participant_status_impl(ChannelId channel_i
|
||||
DialogParticipantStatus status,
|
||||
DialogParticipantStatus old_status,
|
||||
Promise<Unit> &&promise) {
|
||||
if (td_->auth_manager_->is_bot() && status.is_restricted() && status.is_member() && !old_status.is_member()) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
if (status.is_restricted() && status.is_member() && !old_status.is_member()) {
|
||||
// allow bots to restrict left chat members without trying to add them
|
||||
status.set_is_member(false);
|
||||
}
|
||||
|
||||
auto new_until_date = status.get_until_date();
|
||||
if (new_until_date >= 1840000000 && status.is_restricted()) {
|
||||
status = DialogParticipantStatus::Restricted(
|
||||
status.is_member(), new_until_date - 300000000, status.can_send_messages(), status.can_send_media(),
|
||||
status.can_send_stickers(), status.can_send_animations(), status.can_send_games(),
|
||||
status.can_use_inline_bots(), status.can_add_web_page_previews(), old_status.can_send_polls(),
|
||||
old_status.can_change_info_and_settings(), old_status.can_invite_users(), old_status.can_pin_messages());
|
||||
}
|
||||
}
|
||||
if (old_status == status) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
|
Reference in New Issue
Block a user