Replace approve/decline with a single method processChatJoinRequest.

This commit is contained in:
levlam 2021-11-24 11:33:18 +03:00
parent cb7bd82c01
commit 7c0a4117a4
4 changed files with 11 additions and 25 deletions

View File

@ -5021,11 +5021,8 @@ joinChatByInviteLink invite_link:string = Chat;
//@limit The maximum number of chat join requests to return
getChatJoinRequests chat_id:int53 invite_link:string query:string offset_request:chatJoinRequest limit:int32 = ChatJoinRequests;
//@description Approves pending join request in a chat @chat_id Chat identifier @user_id Identifier of the user, which request will be approved
approveChatJoinRequest chat_id:int53 user_id:int53 = Ok;
//@description Declines pending join request in a chat @chat_id Chat identifier @user_id Identifier of the user, which request will be declined
declineChatJoinRequest chat_id:int53 user_id:int53 = Ok;
//@description Handles a pending join request in a chat @chat_id Chat identifier @user_id Identifier of the user that sent the request @approve True, if the request is approved. Otherwise the request is declived
processChatJoinRequest chat_id:int53 user_id:int53 approve:Bool = Ok;
//@description Creates a new call @user_id Identifier of the user to be called @protocol The call protocols supported by the application @is_video True, if a video call needs to be created

View File

@ -6407,16 +6407,10 @@ void Td::on_request(uint64 id, td_api::getChatJoinRequests &request) {
std::move(request.offset_request_), request.limit_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::approveChatJoinRequest &request) {
void Td::on_request(uint64 id, const td_api::processChatJoinRequest &request) {
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->process_dialog_join_requests(DialogId(request.chat_id_), UserId(request.user_id_), true,
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::declineChatJoinRequest &request) {
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->process_dialog_join_requests(DialogId(request.chat_id_), UserId(request.user_id_), false,
std::move(promise));
contacts_manager_->process_dialog_join_requests(DialogId(request.chat_id_), UserId(request.user_id_),
request.approve_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::revokeChatInviteLink &request) {

View File

@ -890,9 +890,7 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::getChatJoinRequests &request);
void on_request(uint64 id, const td_api::approveChatJoinRequest &request);
void on_request(uint64 id, const td_api::declineChatJoinRequest &request);
void on_request(uint64 id, const td_api::processChatJoinRequest &request);
void on_request(uint64 id, td_api::revokeChatInviteLink &request);

View File

@ -3041,16 +3041,13 @@ class CliClient final : public Actor {
as_chat_id(chat_id), invite_link, query,
td_api::make_object<td_api::chatJoinRequest>(as_user_id(offset_user_id), offset_date, string()),
as_limit(limit)));
} else if (op == "acjr") {
} else if (op == "pcjr") {
string chat_id;
string user_id;
get_args(args, chat_id, user_id);
send_request(td_api::make_object<td_api::approveChatJoinRequest>(as_chat_id(chat_id), as_user_id(user_id)));
} else if (op == "dcjr") {
string chat_id;
string user_id;
get_args(args, chat_id, user_id);
send_request(td_api::make_object<td_api::declineChatJoinRequest>(as_chat_id(chat_id), as_user_id(user_id)));
bool approve;
get_args(args, chat_id, user_id, approve);
send_request(
td_api::make_object<td_api::processChatJoinRequest>(as_chat_id(chat_id), as_user_id(user_id), approve));
} else if (op == "drcil") {
string chat_id;
string invite_link;