Avoid duplicate 't' and 'i' photo sizes.

This commit is contained in:
levlam 2022-12-28 20:39:24 +03:00
parent 6aa4558850
commit a77c7d566c
2 changed files with 11 additions and 1 deletions

View File

@ -3461,6 +3461,16 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
if (need_merge_files && (old_photos_size == 1 || (old_photos_size == 2 && old_photo->photos[0].type == 't')) &&
old_photo->photos.back().type == 'i') {
// first time get info about sent photo
if (!new_photo->photos.empty() && new_photo->photos.back().type == 'i') {
// remove previous 'i' size for the photo if any
new_photo->photos.pop_back();
}
if (!new_photo->photos.empty() && new_photo->photos.back().type == 't') {
// remove previous 't' size for the photo if any
new_photo->photos.pop_back();
}
// add back 't' and 'i' sizes
if (old_photos_size == 2) {
new_photo->photos.push_back(old_photo->photos[0]);
}

View File

@ -27944,7 +27944,7 @@ void MessagesManager::on_message_media_edited(DialogId dialog_id, MessageId mess
// message content has already been replaced from updateEdit{Channel,}Message
// need only merge files from edited_content with their uploaded counterparts
// updateMessageContent was already sent and needs to be sent again,
// only if 'i' and 't' sizes from edited_content was added to the photo
// only if 'i' and 't' sizes from edited_content were added to the photo
auto pts = result.ok();
LOG(INFO) << "Successfully edited " << message_id << " in " << dialog_id << " with pts = " << pts
<< " and last edit pts = " << m->last_edit_pts;