Remove excessive user photos instead of adjusting total_count.
GitOrigin-RevId: c66c645eb83e44a62172aff87a576d8b8d04368f
This commit is contained in:
parent
0e77a35b0a
commit
c13068832b
@ -8892,7 +8892,7 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim
|
|||||||
total_count = min_total_count;
|
total_count = min_total_count;
|
||||||
}
|
}
|
||||||
LOG_IF(ERROR, limit < photo_count) << "Requested not more than " << limit << " photos, but " << photo_count
|
LOG_IF(ERROR, limit < photo_count) << "Requested not more than " << limit << " photos, but " << photo_count
|
||||||
<< " returned";
|
<< " received";
|
||||||
|
|
||||||
User *u = get_user(user_id);
|
User *u = get_user(user_id);
|
||||||
if (u == nullptr) {
|
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());
|
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) {
|
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->photos.resize(user_photos->count - user_photos->offset);
|
||||||
<< user_photos->offset << " + " << known_photo_count;
|
|
||||||
user_photos->count = user_photos->offset + known_photo_count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1994,7 +1994,7 @@ class CliClient final : public Actor {
|
|||||||
|
|
||||||
send_request(td_api::make_object<td_api::getChatMessageCount>(
|
send_request(td_api::make_object<td_api::getChatMessageCount>(
|
||||||
as_chat_id(chat_id), get_search_messages_filter(filter), as_bool(return_local)));
|
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 user_id;
|
||||||
string offset;
|
string offset;
|
||||||
string limit;
|
string limit;
|
||||||
|
Reference in New Issue
Block a user