Don't drop photo cache if only minithumbnail was changed.

This commit is contained in:
levlam 2022-11-05 01:25:19 +03:00
parent ce2791fae3
commit 76c13a21bc
2 changed files with 13 additions and 2 deletions

View File

@ -12258,6 +12258,10 @@ void ContactsManager::do_update_user_photo(User *u, UserId user_id, ProfilePhoto
}
}
}
} else if (need_update_dialog_photo_minithumbnail(u->photo.minithumbnail, new_photo.minithumbnail)) {
u->photo.minithumbnail = std::move(new_photo.minithumbnail);
u->is_photo_changed = true;
u->is_changed = true;
}
}
@ -14426,6 +14430,10 @@ void ContactsManager::on_update_chat_photo(Chat *c, ChatId chat_id, DialogPhoto
update_chat_full(chat_full, chat_id, "on_update_chat_photo");
}
}
} else if (need_update_dialog_photo_minithumbnail(c->photo.minithumbnail, photo.minithumbnail)) {
c->photo.minithumbnail = std::move(photo.minithumbnail);
c->is_photo_changed = true;
c->need_save_to_database = true;
}
}
@ -14576,6 +14584,10 @@ void ContactsManager::on_update_channel_photo(Channel *c, ChannelId channel_id,
update_channel_full(channel_full, channel_id, "on_update_channel_photo");
}
}
} else if (need_update_dialog_photo_minithumbnail(c->photo.minithumbnail, photo.minithumbnail)) {
c->photo.minithumbnail = std::move(photo.minithumbnail);
c->is_photo_changed = true;
c->need_save_to_database = true;
}
}

View File

@ -196,8 +196,7 @@ bool is_same_dialog_photo(FileManager *file_manager, DialogId dialog_id, const P
bool need_update_dialog_photo(const DialogPhoto &from, const DialogPhoto &to) {
return from.small_file_id != to.small_file_id || from.big_file_id != to.big_file_id ||
from.has_animation != to.has_animation ||
need_update_dialog_photo_minithumbnail(from.minithumbnail, to.minithumbnail);
from.has_animation != to.has_animation;
}
StringBuilder &operator<<(StringBuilder &string_builder, const DialogPhoto &dialog_photo) {