Ignore invite links to deactivated basic groups.

This commit is contained in:
levlam 2022-03-11 13:00:25 +03:00
parent 242801a2f3
commit ff9f5b88d9
3 changed files with 11 additions and 5 deletions

View File

@ -7509,10 +7509,16 @@ void ContactsManager::delete_all_revoked_dialog_invite_links(DialogId dialog_id,
td_->create_handler<DeleteRevokedExportedChatInvitesQuery>(std::move(promise))->send(dialog_id, creator_user_id);
}
void ContactsManager::check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const {
if (invite_link_infos_.count(invite_link) > 0) {
void ContactsManager::check_dialog_invite_link(const string &invite_link, bool force, Promise<Unit> &&promise) {
auto it = invite_link_infos_.find(invite_link);
if (it != invite_link_infos_.end()) {
auto dialog_id = it->second->dialog_id;
if (!force && dialog_id.get_type() == DialogType::Chat && !get_chat_is_active(dialog_id.get_chat_id())) {
invite_link_infos_.erase(it);
} else {
return promise.set_value(Unit());
}
}
if (!DialogInviteLink::is_valid_invite_link(invite_link)) {
return promise.set_error(Status::Error(400, "Wrong invite link"));

View File

@ -421,7 +421,7 @@ class ContactsManager final : public Actor {
void delete_all_revoked_dialog_invite_links(DialogId dialog_id, UserId creator_user_id, Promise<Unit> &&promise);
void check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const;
void check_dialog_invite_link(const string &invite_link, bool force, Promise<Unit> &&promise);
void import_dialog_invite_link(const string &invite_link, Promise<DialogId> &&promise);

View File

@ -1789,7 +1789,7 @@ class CheckChatInviteLinkRequest final : public RequestActor<> {
string invite_link_;
void do_run(Promise<Unit> &&promise) final {
td_->contacts_manager_->check_dialog_invite_link(invite_link_, std::move(promise));
td_->contacts_manager_->check_dialog_invite_link(invite_link_, get_tries() < 2, std::move(promise));
}
void do_send_result() final {