Rename administrator_user_id to creator_user_id.
This commit is contained in:
parent
c733f8ed34
commit
18fc612b3b
@ -547,7 +547,7 @@ supergroupMembersFilterMention query:string message_thread_id:int53 = Supergroup
|
||||
supergroupMembersFilterBots = SupergroupMembersFilter;
|
||||
|
||||
|
||||
//@description Contains a chat invite link @invite_link Chat invite link @administrator_user_id User identifier of an administrator created the link
|
||||
//@description Contains a chat invite link @invite_link Chat invite link @creator_user_id User identifier of an administrator created the link
|
||||
//@date Point in time (Unix timestamp) when the link was created
|
||||
//@edit_date Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown
|
||||
//@expire_date Point in time (Unix timestamp) when the link will expire; 0 if never
|
||||
@ -555,7 +555,7 @@ supergroupMembersFilterBots = SupergroupMembersFilter;
|
||||
//@member_count Number of chat members, which joined the chat using the link
|
||||
//@is_primary True, if the link is primary. Primary invite link can't have expire date or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time
|
||||
//@is_revoked True, if the link was revoked
|
||||
chatInviteLink invite_link:string administrator_user_id:int32 date:int32 edit_date:int32 expire_date:int32 member_limit:int32 member_count:int32 is_primary:Bool is_revoked:Bool = ChatInviteLink;
|
||||
chatInviteLink invite_link:string creator_user_id:int32 date:int32 edit_date:int32 expire_date:int32 member_limit:int32 member_count:int32 is_primary:Bool is_revoked:Bool = ChatInviteLink;
|
||||
|
||||
//@description Contains a list of chat invite links @total_count Approximate total count of chat invite links found @invite_links List of invite links
|
||||
chatInviteLinks total_count:int32 invite_links:vector<chatInviteLink> = ChatInviteLinks;
|
||||
@ -4492,12 +4492,12 @@ getChatInviteLinkCounts chat_id:int53 = ChatInviteLinkCounts;
|
||||
|
||||
//@description Returns invite links for a chat created by specified administrator. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links
|
||||
//@chat_id Chat identifier
|
||||
//@administrator_user_id User identifier of a chat administrator. Must be an identifier of the current user for non-owner
|
||||
//@creator_user_id User identifier of a chat administrator. Must be an identifier of the current user for non-owner
|
||||
//@is_revoked Pass true if revoked links needs to be returned instead of active or expired
|
||||
//@offset_date Creation date of an invite link starting after which to return invite links; use 0 to get results from the beginning
|
||||
//@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 is_revoked:Bool offset_date:int32 offset_invite_link:string limit:int32 = ChatInviteLinks;
|
||||
getChatInviteLinks chat_id:int53 creator_user_id:int32 is_revoked:Bool offset_date:int32 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 in the chat for own links and owner privileges for other links @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
|
||||
@ -4514,8 +4514,8 @@ deleteRevokedChatInviteLink chat_id:int53 invite_link:string = Ok;
|
||||
|
||||
//@description Deletes all revoked chat invite links created by a given chat administrator. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links
|
||||
//@chat_id Chat identifier
|
||||
//@administrator_user_id User identifier of a chat administrator, which links will be deleted. Must be an identifier of the current user for non-owner
|
||||
deleteAllRevokedChatInviteLinks chat_id:int53 administrator_user_id:int32 = Ok;
|
||||
//@creator_user_id User identifier of a chat administrator, which links will be deleted. Must be an identifier of the current user for non-owner
|
||||
deleteAllRevokedChatInviteLinks chat_id:int53 creator_user_id:int32 = Ok;
|
||||
|
||||
//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; must have URL "t.me", "telegram.me", or "telegram.dog" and query beginning with "/joinchat/" or "/+"
|
||||
checkChatInviteLink invite_link:string = ChatInviteLinkInfo;
|
||||
|
Binary file not shown.
@ -1684,7 +1684,7 @@ class ExportChatInviteQuery : public Td::ResultHandler {
|
||||
if (!invite_link.is_valid()) {
|
||||
return on_error(id, Status::Error(500, "Receive invalid invite link"));
|
||||
}
|
||||
if (invite_link.get_administrator_user_id() != td->contacts_manager_->get_my_id()) {
|
||||
if (invite_link.get_creator_user_id() != td->contacts_manager_->get_my_id()) {
|
||||
return on_error(id, Status::Error(500, "Receive invalid invite link creator"));
|
||||
}
|
||||
if (invite_link.is_permanent()) {
|
||||
@ -1810,7 +1810,7 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, int32 offset_date,
|
||||
void send(DialogId dialog_id, UserId creator_user_id, bool is_revoked, int32 offset_date,
|
||||
const string &offset_invite_link, int32 limit) {
|
||||
dialog_id_ = dialog_id;
|
||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
|
||||
@ -1818,7 +1818,7 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
|
||||
return on_error(0, Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
|
||||
auto input_user = td->contacts_manager_->get_input_user(administrator_user_id);
|
||||
auto input_user = td->contacts_manager_->get_input_user(creator_user_id);
|
||||
CHECK(input_user != nullptr);
|
||||
|
||||
int32 flags = 0;
|
||||
@ -2034,7 +2034,7 @@ class RevokeChatInviteLinkQuery : public Td::ResultHandler {
|
||||
if (!invite_link.is_valid() || !new_invite_link.is_valid()) {
|
||||
return on_error(id, Status::Error(500, "Receive invalid invite link"));
|
||||
}
|
||||
if (new_invite_link.get_administrator_user_id() == td->contacts_manager_->get_my_id() &&
|
||||
if (new_invite_link.get_creator_user_id() == td->contacts_manager_->get_my_id() &&
|
||||
new_invite_link.is_permanent()) {
|
||||
td->contacts_manager_->on_get_permanent_dialog_invite_link(dialog_id_, new_invite_link);
|
||||
}
|
||||
@ -2097,14 +2097,14 @@ class DeleteRevokedExportedChatInvitesQuery : public Td::ResultHandler {
|
||||
explicit DeleteRevokedExportedChatInvitesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, UserId administrator_user_id) {
|
||||
void send(DialogId dialog_id, UserId creator_user_id) {
|
||||
dialog_id_ = dialog_id;
|
||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
|
||||
if (input_peer == nullptr) {
|
||||
return on_error(0, Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
|
||||
auto input_user = td->contacts_manager_->get_input_user(administrator_user_id);
|
||||
auto input_user = td->contacts_manager_->get_input_user(creator_user_id);
|
||||
CHECK(input_user != nullptr);
|
||||
|
||||
send_query(G()->net_query_creator().create(
|
||||
@ -7179,12 +7179,12 @@ void ContactsManager::get_dialog_invite_link_counts(
|
||||
td_->create_handler<GetChatAdminWithInvitesQuery>(std::move(promise))->send(dialog_id);
|
||||
}
|
||||
|
||||
void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked,
|
||||
void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId creator_user_id, bool is_revoked,
|
||||
int32 offset_date, 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, administrator_user_id != get_my_id()));
|
||||
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id, creator_user_id != get_my_id()));
|
||||
|
||||
if (!have_input_user(administrator_user_id)) {
|
||||
if (!have_input_user(creator_user_id)) {
|
||||
return promise.set_error(Status::Error(400, "Administrator user not found"));
|
||||
}
|
||||
|
||||
@ -7193,7 +7193,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, is_revoked, offset_date, offset_invite_link, limit);
|
||||
->send(dialog_id, creator_user_id, is_revoked, offset_date, offset_invite_link, limit);
|
||||
}
|
||||
|
||||
void ContactsManager::get_dialog_invite_link_users(
|
||||
@ -7230,16 +7230,15 @@ void ContactsManager::delete_revoked_dialog_invite_link(DialogId dialog_id, cons
|
||||
td_->create_handler<DeleteExportedChatInviteQuery>(std::move(promise))->send(dialog_id, invite_link);
|
||||
}
|
||||
|
||||
void ContactsManager::delete_all_revoked_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id,
|
||||
void ContactsManager::delete_all_revoked_dialog_invite_links(DialogId dialog_id, UserId creator_user_id,
|
||||
Promise<Unit> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id, administrator_user_id != get_my_id()));
|
||||
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id, creator_user_id != get_my_id()));
|
||||
|
||||
if (!have_input_user(administrator_user_id)) {
|
||||
if (!have_input_user(creator_user_id)) {
|
||||
return promise.set_error(Status::Error(400, "Administrator user not found"));
|
||||
}
|
||||
|
||||
td_->create_handler<DeleteRevokedExportedChatInvitesQuery>(std::move(promise))
|
||||
->send(dialog_id, administrator_user_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 {
|
||||
@ -9363,7 +9362,7 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val
|
||||
dependencies.user_ids.insert(participant.user_id);
|
||||
dependencies.user_ids.insert(participant.inviter_user_id);
|
||||
}
|
||||
dependencies.user_ids.insert(chat_full->invite_link.get_administrator_user_id());
|
||||
dependencies.user_ids.insert(chat_full->invite_link.get_creator_user_id());
|
||||
resolve_dependencies_force(td_, dependencies, "chat_full");
|
||||
|
||||
for (auto &participant : chat_full->participants) {
|
||||
@ -9459,7 +9458,7 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
|
||||
add_dialog_and_dependencies(dependencies, DialogId(channel_full->linked_channel_id));
|
||||
dependencies.chat_ids.insert(channel_full->migrated_from_chat_id);
|
||||
dependencies.user_ids.insert(channel_full->bot_user_ids.begin(), channel_full->bot_user_ids.end());
|
||||
dependencies.user_ids.insert(channel_full->invite_link.get_administrator_user_id());
|
||||
dependencies.user_ids.insert(channel_full->invite_link.get_creator_user_id());
|
||||
resolve_dependencies_force(td_, dependencies, "channel_full");
|
||||
|
||||
for (auto &user_id : channel_full->bot_user_ids) {
|
||||
|
@ -404,7 +404,7 @@ class ContactsManager : public Actor {
|
||||
void get_dialog_invite_link_counts(DialogId dialog_id,
|
||||
Promise<td_api::object_ptr<td_api::chatInviteLinkCounts>> &&promise);
|
||||
|
||||
void get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, int32 offset_date,
|
||||
void get_dialog_invite_links(DialogId dialog_id, UserId creator_user_id, bool is_revoked, int32 offset_date,
|
||||
const string &offset_invite_link, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise);
|
||||
|
||||
@ -417,8 +417,7 @@ class ContactsManager : public Actor {
|
||||
|
||||
void delete_revoked_dialog_invite_link(DialogId dialog_id, const string &invite_link, Promise<Unit> &&promise);
|
||||
|
||||
void delete_all_revoked_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id,
|
||||
Promise<Unit> &&promise);
|
||||
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;
|
||||
|
||||
|
@ -26,10 +26,10 @@ DialogInviteLink::DialogInviteLink(tl_object_ptr<telegram_api::chatInviteExporte
|
||||
|
||||
invite_link_ = std::move(exported_invite->link_);
|
||||
LOG_IF(ERROR, !is_valid_invite_link(invite_link_)) << "Unsupported invite link " << invite_link_;
|
||||
administrator_user_id_ = UserId(exported_invite->admin_id_);
|
||||
if (!administrator_user_id_.is_valid()) {
|
||||
LOG(ERROR) << "Receive invalid " << administrator_user_id_ << " as creator of a link " << invite_link_;
|
||||
administrator_user_id_ = UserId();
|
||||
creator_user_id_ = UserId(exported_invite->admin_id_);
|
||||
if (!creator_user_id_.is_valid()) {
|
||||
LOG(ERROR) << "Receive invalid " << creator_user_id_ << " as creator of a link " << invite_link_;
|
||||
creator_user_id_ = UserId();
|
||||
}
|
||||
date_ = exported_invite->date_;
|
||||
if (date_ < 1000000000) {
|
||||
@ -109,12 +109,12 @@ td_api::object_ptr<td_api::chatInviteLink> DialogInviteLink::get_chat_invite_lin
|
||||
}
|
||||
|
||||
return td_api::make_object<td_api::chatInviteLink>(
|
||||
invite_link_, contacts_manager->get_user_id_object(administrator_user_id_, "get_chat_invite_link_object"), date_,
|
||||
invite_link_, contacts_manager->get_user_id_object(creator_user_id_, "get_chat_invite_link_object"), date_,
|
||||
edit_date_, expire_date_, usage_limit_, usage_count_, is_permanent_, is_revoked_);
|
||||
}
|
||||
|
||||
bool operator==(const DialogInviteLink &lhs, const DialogInviteLink &rhs) {
|
||||
return lhs.invite_link_ == rhs.invite_link_ && lhs.administrator_user_id_ == rhs.administrator_user_id_ &&
|
||||
return lhs.invite_link_ == rhs.invite_link_ && lhs.creator_user_id_ == rhs.creator_user_id_ &&
|
||||
lhs.date_ == rhs.date_ && lhs.edit_date_ == rhs.edit_date_ && lhs.expire_date_ == rhs.expire_date_ &&
|
||||
lhs.usage_limit_ == rhs.usage_limit_ && lhs.usage_count_ == rhs.usage_count_ &&
|
||||
lhs.is_permanent_ == rhs.is_permanent_ && lhs.is_revoked_ == rhs.is_revoked_;
|
||||
@ -125,7 +125,7 @@ bool operator!=(const DialogInviteLink &lhs, const DialogInviteLink &rhs) {
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const DialogInviteLink &invite_link) {
|
||||
return string_builder << "ChatInviteLink[" << invite_link.invite_link_ << " by " << invite_link.administrator_user_id_
|
||||
return string_builder << "ChatInviteLink[" << invite_link.invite_link_ << " by " << invite_link.creator_user_id_
|
||||
<< " created at " << invite_link.date_ << " edited at " << invite_link.edit_date_
|
||||
<< " expiring at " << invite_link.expire_date_ << " used by " << invite_link.usage_count_
|
||||
<< " with usage limit " << invite_link.usage_limit_ << "]";
|
||||
|
@ -21,7 +21,7 @@ class ContactsManager;
|
||||
|
||||
class DialogInviteLink {
|
||||
string invite_link_;
|
||||
UserId administrator_user_id_;
|
||||
UserId creator_user_id_;
|
||||
int32 date_ = 0;
|
||||
int32 edit_date_ = 0;
|
||||
int32 expire_date_ = 0;
|
||||
@ -48,7 +48,7 @@ class DialogInviteLink {
|
||||
td_api::object_ptr<td_api::chatInviteLink> get_chat_invite_link_object(const ContactsManager *contacts_manager) const;
|
||||
|
||||
bool is_valid() const {
|
||||
return !invite_link_.empty() && administrator_user_id_.is_valid() && date_ > 0;
|
||||
return !invite_link_.empty() && creator_user_id_.is_valid() && date_ > 0;
|
||||
}
|
||||
|
||||
bool is_permanent() const {
|
||||
@ -59,8 +59,8 @@ class DialogInviteLink {
|
||||
return invite_link_;
|
||||
}
|
||||
|
||||
UserId get_administrator_user_id() const {
|
||||
return administrator_user_id_;
|
||||
UserId get_creator_user_id() const {
|
||||
return creator_user_id_;
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -79,7 +79,7 @@ class DialogInviteLink {
|
||||
STORE_FLAG(has_edit_date);
|
||||
END_STORE_FLAGS();
|
||||
store(invite_link_, storer);
|
||||
store(administrator_user_id_, storer);
|
||||
store(creator_user_id_, storer);
|
||||
store(date_, storer);
|
||||
if (has_expire_date) {
|
||||
store(expire_date_, storer);
|
||||
@ -111,7 +111,7 @@ class DialogInviteLink {
|
||||
PARSE_FLAG(has_edit_date);
|
||||
END_PARSE_FLAGS();
|
||||
parse(invite_link_, parser);
|
||||
parse(administrator_user_id_, parser);
|
||||
parse(creator_user_id_, parser);
|
||||
parse(date_, parser);
|
||||
if (has_expire_date) {
|
||||
parse(expire_date_, parser);
|
||||
|
@ -6348,7 +6348,7 @@ void Td::on_request(uint64 id, td_api::getChatInviteLinks &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.offset_invite_link_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
contacts_manager_->get_dialog_invite_links(DialogId(request.chat_id_), UserId(request.administrator_user_id_),
|
||||
contacts_manager_->get_dialog_invite_links(DialogId(request.chat_id_), UserId(request.creator_user_id_),
|
||||
request.is_revoked_, request.offset_date_, request.offset_invite_link_,
|
||||
request.limit_, std::move(promise));
|
||||
}
|
||||
@ -6380,7 +6380,7 @@ void Td::on_request(uint64 id, const td_api::deleteAllRevokedChatInviteLinks &re
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
contacts_manager_->delete_all_revoked_dialog_invite_links(DialogId(request.chat_id_),
|
||||
UserId(request.administrator_user_id_), std::move(promise));
|
||||
UserId(request.creator_user_id_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::checkChatInviteLink &request) {
|
||||
|
@ -2751,14 +2751,14 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::getChatInviteLink>(as_chat_id(chat_id), invite_link));
|
||||
} else if (op == "gcils" || op == "gcilr") {
|
||||
string chat_id;
|
||||
string administrator_user_id;
|
||||
string creator_user_id;
|
||||
int32 offset_date;
|
||||
string offset_invite_link;
|
||||
string limit;
|
||||
get_args(args, chat_id, administrator_user_id, offset_date, offset_invite_link, limit);
|
||||
send_request(td_api::make_object<td_api::getChatInviteLinks>(as_chat_id(chat_id),
|
||||
as_user_id(administrator_user_id), op == "gcilr",
|
||||
offset_date, offset_invite_link, as_limit(limit)));
|
||||
get_args(args, chat_id, creator_user_id, offset_date, offset_invite_link, limit);
|
||||
send_request(td_api::make_object<td_api::getChatInviteLinks>(as_chat_id(chat_id), as_user_id(creator_user_id),
|
||||
op == "gcilr", offset_date, offset_invite_link,
|
||||
as_limit(limit)));
|
||||
} else if (op == "gcilm") {
|
||||
string chat_id;
|
||||
string invite_link;
|
||||
@ -2776,10 +2776,10 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::deleteRevokedChatInviteLink>(as_chat_id(chat_id), invite_link));
|
||||
} else if (op == "darcil") {
|
||||
string chat_id;
|
||||
string administrator_user_id;
|
||||
get_args(args, chat_id, administrator_user_id);
|
||||
string creator_user_id;
|
||||
get_args(args, chat_id, creator_user_id);
|
||||
send_request(td_api::make_object<td_api::deleteAllRevokedChatInviteLinks>(as_chat_id(chat_id),
|
||||
as_user_id(administrator_user_id)));
|
||||
as_user_id(creator_user_id)));
|
||||
} else if (op == "ccil") {
|
||||
send_request(td_api::make_object<td_api::checkChatInviteLink>(args));
|
||||
} else if (op == "jcbil") {
|
||||
|
Loading…
Reference in New Issue
Block a user