Allow loading channel participants without bot info.
This commit is contained in:
parent
92327f1fe7
commit
415a64ff24
@ -13492,7 +13492,8 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
|
||||
|
||||
std::pair<int32, vector<DialogParticipant>> ContactsManager::get_channel_participants(
|
||||
ChannelId channel_id, const tl_object_ptr<td_api::SupergroupMembersFilter> &filter, const string &additional_query,
|
||||
int32 offset, int32 limit, int32 additional_limit, int64 &random_id, bool force, Promise<Unit> &&promise) {
|
||||
int32 offset, int32 limit, int32 additional_limit, int64 &random_id, bool without_bot_info, bool force,
|
||||
Promise<Unit> &&promise) {
|
||||
if (random_id != 0) {
|
||||
// request has already been sent before
|
||||
auto it = received_channel_participants_.find(random_id);
|
||||
@ -13537,7 +13538,10 @@ std::pair<int32, vector<DialogParticipant>> ContactsManager::get_channel_partici
|
||||
}
|
||||
|
||||
auto channel_full = get_channel_full_force(channel_id, "get_channel_participants");
|
||||
if (channel_full == nullptr || (!force && channel_full->is_expired())) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
without_bot_info = true;
|
||||
}
|
||||
if (!without_bot_info && (channel_full == nullptr || (!force && channel_full->is_expired()))) {
|
||||
if (force) {
|
||||
LOG(ERROR) << "Can't find cached ChannelFull";
|
||||
} else {
|
||||
|
@ -509,8 +509,8 @@ class ContactsManager : public Actor {
|
||||
|
||||
std::pair<int32, vector<DialogParticipant>> get_channel_participants(
|
||||
ChannelId channel_id, const tl_object_ptr<td_api::SupergroupMembersFilter> &filter,
|
||||
const string &additional_query, int32 offset, int32 limit, int32 additional_limit, int64 &random_id, bool force,
|
||||
Promise<Unit> &&promise);
|
||||
const string &additional_query, int32 offset, int32 limit, int32 additional_limit, int64 &random_id,
|
||||
bool without_bot_info, bool force, Promise<Unit> &&promise);
|
||||
|
||||
void send_get_channel_participants_query(ChannelId channel_id, ChannelParticipantsFilter filter, int32 offset,
|
||||
int32 limit, int64 random_id, Promise<Unit> &&promise);
|
||||
|
@ -30478,8 +30478,8 @@ std::pair<int32, vector<DialogParticipant>> MessagesManager::search_private_chat
|
||||
}
|
||||
|
||||
std::pair<int32, vector<DialogParticipant>> MessagesManager::search_dialog_participants(
|
||||
DialogId dialog_id, const string &query, int32 limit, DialogParticipantsFilter filter, int64 &random_id, bool force,
|
||||
Promise<Unit> &&promise) {
|
||||
DialogId dialog_id, const string &query, int32 limit, DialogParticipantsFilter filter, int64 &random_id,
|
||||
bool without_bot_info, bool force, Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Receive searchChatMembers request to search for " << query << " in " << dialog_id;
|
||||
if (!have_dialog_force(dialog_id)) {
|
||||
promise.set_error(Status::Error(3, "Chat not found"));
|
||||
@ -30548,7 +30548,7 @@ std::pair<int32, vector<DialogParticipant>> MessagesManager::search_dialog_parti
|
||||
|
||||
return td_->contacts_manager_->get_channel_participants(dialog_id.get_channel_id(), request_filter,
|
||||
additional_query, 0, limit, additional_limit, random_id,
|
||||
force, std::move(promise));
|
||||
without_bot_info, force, std::move(promise));
|
||||
}
|
||||
case DialogType::SecretChat: {
|
||||
promise.set_value(Unit());
|
||||
|
@ -534,8 +534,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
std::pair<int32, vector<DialogParticipant>> search_dialog_participants(DialogId dialog_id, const string &query,
|
||||
int32 limit, DialogParticipantsFilter filter,
|
||||
int64 &random_id, bool force,
|
||||
Promise<Unit> &&promise);
|
||||
int64 &random_id, bool without_bot_info,
|
||||
bool force, Promise<Unit> &&promise);
|
||||
|
||||
vector<DialogAdministrator> get_dialog_administrators(DialogId dialog_id, int left_tries, Promise<Unit> &&promise);
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ class SearchChatMembersRequest : public RequestActor<> {
|
||||
|
||||
void do_run(Promise<Unit> &&promise) override {
|
||||
participants_ = td->messages_manager_->search_dialog_participants(dialog_id_, query_, limit_, filter_, random_id_,
|
||||
get_tries() < 3, std::move(promise));
|
||||
false, get_tries() < 3, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
@ -2286,8 +2286,8 @@ class GetSupergroupMembersRequest : public RequestActor<> {
|
||||
std::pair<int32, vector<DialogParticipant>> participants_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) override {
|
||||
participants_ = td->contacts_manager_->get_channel_participants(channel_id_, filter_, string(), offset_, limit_, -1,
|
||||
random_id_, get_tries() < 3, std::move(promise));
|
||||
participants_ = td->contacts_manager_->get_channel_participants(
|
||||
channel_id_, filter_, string(), offset_, limit_, -1, random_id_, false, get_tries() < 3, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
|
Loading…
Reference in New Issue
Block a user