Remove extract_group_invite_privacy_forbidden_updates.

This commit is contained in:
levlam 2024-03-30 02:56:24 +03:00
parent cfeed162e9
commit 0a21620194
5 changed files with 1 additions and 55 deletions

View File

@ -596,20 +596,7 @@ class InviteToChannelQuery final : public Td::ResultHandler {
auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for InviteToChannelQuery: " << to_string(ptr);
td_->contacts_manager_->invalidate_channel_full(channel_id_, false, "InviteToChannelQuery");
auto user_ids = td_->updates_manager_->extract_group_invite_privacy_forbidden_updates(ptr->updates_);
auto promise = PromiseCreator::lambda([dialog_id = DialogId(channel_id_), user_ids = std::move(user_ids),
promise = std::move(promise_)](Result<Unit> &&result) mutable {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
promise.set_value(Unit());
if (!user_ids.empty()) {
send_closure(G()->dialog_participant_manager(),
&DialogParticipantManager::send_update_add_chat_members_privacy_forbidden, dialog_id,
std::move(user_ids), "InviteToChannelQuery");
}
});
td_->updates_manager_->on_get_updates(std::move(std::move(ptr->updates_)), std::move(promise));
td_->updates_manager_->on_get_updates(std::move(std::move(ptr->updates_)), std::move(promise_));
}
void on_error(Status status) final {

View File

@ -13678,11 +13678,6 @@ MessageFullId MessagesManager::on_get_message(MessageInfo &&message_info, const
pending_created_dialogs_.erase(it);
pending_created_dialog.promise_.set_value(get_chat_object(d, "on_get_message"));
if (!pending_created_dialog.group_invite_privacy_forbidden_user_ids_.empty()) {
send_closure(G()->dialog_participant_manager(),
&DialogParticipantManager::send_update_add_chat_members_privacy_forbidden, dialog_id,
std::move(pending_created_dialog.group_invite_privacy_forbidden_user_ids_), "on_get_message");
}
}
}
@ -30860,8 +30855,6 @@ void MessagesManager::on_create_new_dialog(telegram_api::object_ptr<telegram_api
if (pending_created_dialogs_.count(dialog_id) == 0) {
PendingCreatedDialog pending_created_dialog;
pending_created_dialog.promise_ = std::move(promise);
pending_created_dialog.group_invite_privacy_forbidden_user_ids_ =
td_->updates_manager_->extract_group_invite_privacy_forbidden_updates(updates);
pending_created_dialogs_.emplace(dialog_id, std::move(pending_created_dialog));
} else {
LOG(ERROR) << "Receive twice " << dialog_id << " as result of chat creation";

View File

@ -3197,7 +3197,6 @@ class MessagesManager final : public Actor {
struct PendingCreatedDialog {
Promise<td_api::object_ptr<td_api::chat>> promise_;
vector<UserId> group_invite_privacy_forbidden_user_ids_;
};
FlatHashMap<DialogId, PendingCreatedDialog, DialogIdHash> pending_created_dialogs_;

View File

@ -1384,36 +1384,6 @@ bool UpdatesManager::are_empty_updates(const telegram_api::Updates *updates_ptr)
}
}
vector<UserId> UpdatesManager::extract_group_invite_privacy_forbidden_updates(
tl_object_ptr<telegram_api::Updates> &updates_ptr) {
return {};
/*
auto updates = get_updates(updates_ptr.get());
if (updates == nullptr) {
LOG(ERROR) << "Can't find updateGroupInvitePrivacyForbidden updates";
return {};
}
LOG(INFO) << "Extract updateGroupInvitePrivacyForbidden updates from " << updates->size() << " updates";
vector<UserId> user_ids;
for (auto &update_ptr : *updates) {
if (update_ptr->get_id() != telegram_api::updateGroupInvitePrivacyForbidden::ID) {
continue;
}
auto update = telegram_api::move_object_as<telegram_api::updateGroupInvitePrivacyForbidden>(update_ptr);
UserId user_id(update->user_id_);
if (!user_id.is_valid()) {
LOG(ERROR) << "Receive " << to_string(update);
continue;
}
user_ids.push_back(user_id);
}
if (!user_ids.empty()) {
td::remove_if(*updates, [](auto &update) { return update == nullptr; });
}
return user_ids;
*/
}
FlatHashSet<int64> UpdatesManager::get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr) {
FlatHashSet<int64> random_ids;
auto updates = get_updates(updates_ptr);

View File

@ -104,9 +104,6 @@ class UpdatesManager final : public Actor {
static bool are_empty_updates(const telegram_api::Updates *updates_ptr);
static vector<UserId> extract_group_invite_privacy_forbidden_updates(
tl_object_ptr<telegram_api::Updates> &updates_ptr);
static FlatHashSet<int64> get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr);
static const telegram_api::Message *get_message_by_random_id(const telegram_api::Updates *updates_ptr,