Add getChatInviteLinks.is_revoked.

This commit is contained in:
levlam 2021-01-18 19:32:53 +03:00
parent 091d08b6a9
commit d52c676912
6 changed files with 16 additions and 9 deletions

View File

@ -4381,8 +4381,9 @@ createChatInviteLink chat_id:int53 expire_date:int32 member_limit:int32 is_perma
editChatInviteLink chat_id:int53 invite_link:string expire_date:int32 member_limit:int32 is_revoked:Bool = ChatInviteLink;
//@description Returns exported invite links for a chat. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @administrator_user_id If not 0, only invite links created by the specified administrator will be returned
//@is_revoked Pass true if revoked links needs to be returned instead of active or expired
//@offset_invite_link Invite link starting after which to return invite links; use empty string to get results from the beginning @limit Maximum number of invite links to return
getChatInviteLinks chat_id:int53 administrator_user_id:int32 offset_invite_link:string limit:int32 = ChatInviteLinks;
getChatInviteLinks chat_id:int53 administrator_user_id:int32 is_revoked:Bool offset_invite_link:string limit:int32 = ChatInviteLinks;
//@description Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @invite_link Invite link for which to return chat members
//@offset_member A chat member from which to return next chat members; use null to get results from the beginning @limit Maximum number of chat members to return

Binary file not shown.

View File

@ -1656,7 +1656,8 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
: promise_(std::move(promise)) {
}
void send(DialogId dialog_id, UserId administrator_user_id, const string &offset_invite_link, int32 limit) {
void send(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, const string &offset_invite_link,
int32 limit) {
dialog_id_ = dialog_id;
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
if (input_peer == nullptr) {
@ -1672,6 +1673,9 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
if (!offset_invite_link.empty()) {
flags |= telegram_api::messages_getExportedChatInvites::OFFSET_LINK_MASK;
}
if (is_revoked) {
flags |= telegram_api::messages_getExportedChatInvites::REVOKED_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::messages_getExportedChatInvites(
flags, false /*ignored*/, std::move(input_peer), std::move(input_user), offset_invite_link, limit)));
}
@ -7083,7 +7087,7 @@ void ContactsManager::edit_dialog_invite_link(DialogId dialog_id, const string &
->send(dialog_id, invite_link, expire_date, usage_limit, is_revoked);
}
void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id,
void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked,
const string &offset_invite_link, int32 limit,
Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise) {
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id));
@ -7097,7 +7101,7 @@ void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId adminis
}
td_->create_handler<GetExportedChatInvitesQuery>(std::move(promise))
->send(dialog_id, administrator_user_id, offset_invite_link, limit);
->send(dialog_id, administrator_user_id, is_revoked, offset_invite_link, limit);
}
void ContactsManager::get_dialog_invite_link_users(

View File

@ -398,8 +398,9 @@ class ContactsManager : public Actor {
void edit_dialog_invite_link(DialogId dialog_id, const string &link, int32 expire_date, int32 usage_limit,
bool is_revoked, Promise<td_api::object_ptr<td_api::chatInviteLink>> &&promise);
void get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, const string &offset_invite_link,
int32 limit, Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise);
void get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked,
const string &offset_invite_link, int32 limit,
Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise);
void get_dialog_invite_link_users(DialogId dialog_id, const string &invite_link,
td_api::object_ptr<td_api::chatInviteLinkMember> offset_member, int32 limit,

View File

@ -6292,7 +6292,8 @@ void Td::on_request(uint64 id, td_api::getChatInviteLinks &request) {
CREATE_REQUEST_PROMISE();
CLEAN_INPUT_STRING(request.offset_invite_link_);
contacts_manager_->get_dialog_invite_links(DialogId(request.chat_id_), UserId(request.administrator_user_id_),
request.offset_invite_link_, request.limit_, std::move(promise));
request.is_revoked_, request.offset_invite_link_, request.limit_,
std::move(promise));
}
void Td::on_request(uint64 id, td_api::getChatInviteLinkMembers &request) {

View File

@ -2701,14 +2701,14 @@ class CliClient final : public Actor {
get_args(args, chat_id, invite_link, expire_date, member_limit, is_revoked);
send_request(td_api::make_object<td_api::editChatInviteLink>(as_chat_id(chat_id), invite_link, expire_date,
member_limit, is_revoked));
} else if (op == "gcil") {
} else if (op == "gcil" || op == "gcilr") {
string chat_id;
string administrator_user_id;
string offset_invite_link;
string limit;
get_args(args, chat_id, administrator_user_id, offset_invite_link, limit);
send_request(td_api::make_object<td_api::getChatInviteLinks>(
as_chat_id(chat_id), as_user_id(administrator_user_id), offset_invite_link, as_limit(limit)));
as_chat_id(chat_id), as_user_id(administrator_user_id), op == "gcilr", offset_invite_link, as_limit(limit)));
} else if (op == "gcilm") {
string chat_id;
string invite_link;