[FIX] web_editor: don't reoptimize already optimized image if repicked

Previously, if you double-clicked an image in the web editor with the
intention to change it, but the image had already been optimized, and
then repicked the same, already optimized image, the image would be
optimized again even though it had not changed. This commit fixes that
by making the media-dialog not trigger an image_changed event in those
cases, and by leaving the initial image untouched.

Linked to issue #57604

closes odoo/odoo#64038

X-original-commit: 4d3655304205cc9785ef696a47a17a41242d297a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2021-01-04 17:45:37 +00:00
committed by qsm-odoo
parent 07cb80cd26
commit dfcfca15d5
@@ -418,7 +418,7 @@ var FileWidget = SearchableMediaWidget.extend({
}
const img = selected[0];
if (!img || !img.id) {
if (!img || !img.id || this.$media.attr('src') === img.image_src) {
return this.media;
}