Remove updateAddChatMembersPrivacyForbidden: use USER_PRIVACY_RESTRICTED error message instead.

This commit is contained in:
levlam 2024-04-10 09:52:21 +03:00
parent a784e6fe14
commit 6c2becce09
3 changed files with 0 additions and 31 deletions

View File

@ -7176,9 +7176,6 @@ updateSpeedLimitNotification is_upload:Bool = Update;
//@description The list of contacts that had birthdays recently or will have birthday soon has changed @close_birthday_users List of contact users with close birthday //@description The list of contacts that had birthdays recently or will have birthday soon has changed @close_birthday_users List of contact users with close birthday
updateContactCloseBirthdays close_birthday_users:vector<closeBirthdayUser> = Update; updateContactCloseBirthdays close_birthday_users:vector<closeBirthdayUser> = Update;
//@description Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate @chat_id Chat identifier @user_ids Identifiers of users, which weren't added because of their privacy settings
updateAddChatMembersPrivacyForbidden chat_id:int53 user_ids:vector<int53> = Update;
//@description Autosave settings for some type of chats were updated @scope Type of chats for which autosave settings were updated @settings The new autosave settings; may be null if the settings are reset to default //@description Autosave settings for some type of chats were updated @scope Type of chats for which autosave settings were updated @settings The new autosave settings; may be null if the settings are reset to default
updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update; updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update;

View File

@ -495,12 +495,6 @@ class EditChatAdminQuery final : public Td::ResultHandler {
} }
void on_error(Status status) final { void on_error(Status status) final {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
// impossible now, because the user must be in the chat already
td_->dialog_participant_manager_->send_update_add_chat_members_privacy_forbidden(DialogId(chat_id_), {user_id_},
"EditChatAdminQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
}
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
}; };
@ -649,11 +643,6 @@ class EditChannelAdminQuery final : public Td::ResultHandler {
} }
void on_error(Status status) final { void on_error(Status status) final {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->dialog_participant_manager_->send_update_add_chat_members_privacy_forbidden(
DialogId(channel_id_), {user_id_}, "EditChannelAdminQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
}
td_->chat_manager_->on_get_channel_error(channel_id_, status, "EditChannelAdminQuery"); td_->chat_manager_->on_get_channel_error(channel_id_, status, "EditChannelAdminQuery");
td_->chat_manager_->invalidate_channel_full(channel_id_, false, "EditChannelAdminQuery"); td_->chat_manager_->invalidate_channel_full(channel_id_, false, "EditChannelAdminQuery");
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
@ -807,11 +796,6 @@ class EditChannelCreatorQuery final : public Td::ResultHandler {
} }
void on_error(Status status) final { void on_error(Status status) final {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->dialog_participant_manager_->send_update_add_chat_members_privacy_forbidden(
DialogId(channel_id_), {user_id_}, "EditChannelCreatorQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
}
td_->chat_manager_->on_get_channel_error(channel_id_, status, "EditChannelCreatorQuery"); td_->chat_manager_->on_get_channel_error(channel_id_, status, "EditChannelCreatorQuery");
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
@ -2699,16 +2683,6 @@ void DialogParticipantManager::speculative_add_channel_user(ChannelId channel_id
td_->chat_manager_->speculative_add_channel_user(channel_id, user_id, new_status, old_status); td_->chat_manager_->speculative_add_channel_user(channel_id, user_id, new_status, old_status);
} }
void DialogParticipantManager::send_update_add_chat_members_privacy_forbidden(DialogId dialog_id,
vector<UserId> user_ids,
const char *source) {
td_->dialog_manager_->force_create_dialog(dialog_id, source);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateAddChatMembersPrivacyForbidden>(
td_->dialog_manager_->get_chat_id_object(dialog_id, "updateAddChatMembersPrivacyForbidden"),
td_->user_manager_->get_user_ids_object(user_ids, source)));
}
void DialogParticipantManager::on_channel_participant_cache_timeout_callback(void *dialog_participant_manager_ptr, void DialogParticipantManager::on_channel_participant_cache_timeout_callback(void *dialog_participant_manager_ptr,
int64 channel_id_long) { int64 channel_id_long) {
if (G()->close_flag()) { if (G()->close_flag()) {

View File

@ -130,8 +130,6 @@ class DialogParticipantManager final : public Actor {
void on_set_channel_participant_status(ChannelId channel_id, DialogId participant_dialog_id, void on_set_channel_participant_status(ChannelId channel_id, DialogId participant_dialog_id,
DialogParticipantStatus status); DialogParticipantStatus status);
void send_update_add_chat_members_privacy_forbidden(DialogId dialog_id, vector<UserId> user_ids, const char *source);
bool have_channel_participant_cache(ChannelId channel_id) const; bool have_channel_participant_cache(ChannelId channel_id) const;
void add_channel_participant_to_cache(ChannelId channel_id, const DialogParticipant &dialog_participant, void add_channel_participant_to_cache(ChannelId channel_id, const DialogParticipant &dialog_participant,