Remove excessive user photos instead of adjusting total_count.

GitOrigin-RevId: c66c645eb83e44a62172aff87a576d8b8d04368f
This commit is contained in:
levlam 2020-05-18 16:23:30 +03:00
parent 0e77a35b0a
commit c13068832b
2 changed files with 3 additions and 6 deletions

View File

@ -8892,7 +8892,7 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim
total_count = min_total_count;
}
LOG_IF(ERROR, limit < photo_count) << "Requested not more than " << limit << " photos, but " << photo_count
<< " returned";
<< " received";
User *u = get_user(user_id);
if (u == nullptr) {
@ -8962,11 +8962,8 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim
}
auto known_photo_count = narrow_cast<int32>(user_photos->photos.size());
CHECK(user_photos->count >= known_photo_count);
if (user_photos->offset + known_photo_count > user_photos->count) {
LOG(ERROR) << "Fix total photo count of " << user_id << " from " << user_photos->count << " to "
<< user_photos->offset << " + " << known_photo_count;
user_photos->count = user_photos->offset + known_photo_count;
user_photos->photos.resize(user_photos->count - user_photos->offset);
}
}

View File

@ -1994,7 +1994,7 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::getChatMessageCount>(
as_chat_id(chat_id), get_search_messages_filter(filter), as_bool(return_local)));
} else if (op == "gup" || op == "GetUserPhotos") {
} else if (op == "gup" || op == "gupf") {
string user_id;
string offset;
string limit;