Add force to get_user_full.

GitOrigin-RevId: 182ab8a99142a12c51662ee0928480f6a3e03f91
This commit is contained in:
levlam 2020-04-07 03:23:53 +03:00
parent 9df4c5dcf9
commit 1d8004d279
4 changed files with 5 additions and 5 deletions

View File

@ -11576,7 +11576,7 @@ void ContactsManager::reload_user(UserId user_id, Promise<Unit> &&promise) {
td_->create_handler<GetUsersQuery>(std::move(promise))->send(std::move(users));
}
bool ContactsManager::get_user_full(UserId user_id, Promise<Unit> &&promise) {
bool ContactsManager::get_user_full(UserId user_id, bool force, Promise<Unit> &&promise) {
auto u = get_user(user_id);
if (u == nullptr) {
promise.set_error(Status::Error(6, "User not found"));
@ -11597,7 +11597,7 @@ bool ContactsManager::get_user_full(UserId user_id, Promise<Unit> &&promise) {
if (user_full->is_expired() || is_bot_info_expired(user_id, u->bot_info_version)) {
auto input_user = get_input_user(user_id);
CHECK(input_user != nullptr);
if (td_->auth_manager_->is_bot()) {
if (td_->auth_manager_->is_bot() && !force) {
send_get_user_full_query(user_id, std::move(input_user), std::move(promise), "get expired user_full");
return false;
} else {

View File

@ -428,7 +428,7 @@ class ContactsManager : public Actor {
UserId get_me(Promise<Unit> &&promise);
bool get_user(UserId user_id, int left_tries, Promise<Unit> &&promise);
void reload_user(UserId user_id, Promise<Unit> &&promise);
bool get_user_full(UserId user_id, Promise<Unit> &&promise);
bool get_user_full(UserId user_id, bool force, Promise<Unit> &&promise);
void reload_user_full(UserId user_id);
std::pair<int32, vector<const Photo *>> get_user_profile_photos(UserId user_id, int32 offset, int32 limit,

View File

@ -13764,7 +13764,7 @@ MessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId mes
void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise) {
switch (dialog_id.get_type()) {
case DialogType::User:
td_->contacts_manager_->get_user_full(dialog_id.get_user_id(), std::move(promise));
td_->contacts_manager_->get_user_full(dialog_id.get_user_id(), false, std::move(promise));
return;
case DialogType::Chat:
td_->contacts_manager_->get_chat_full(dialog_id.get_chat_id(), false, std::move(promise));

View File

@ -678,7 +678,7 @@ class GetUserFullInfoRequest : public RequestActor<> {
UserId user_id_;
void do_run(Promise<Unit> &&promise) override {
td->contacts_manager_->get_user_full(user_id_, std::move(promise));
td->contacts_manager_->get_user_full(user_id_, get_tries() < 2, std::move(promise));
}
void do_send_result() override {