[FIX] web_editor: fix closing optimize image modal
The optimize modal was adding images to the modal even when closing without optimizing the image. Now when we close the modal, no images is append to it, same if we click on "Keep Original" while optimizing an already existing image. Part of #33983 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -216,7 +216,9 @@ var ImageOptimizeDialog = Dialog.extend({
|
||||
* @private
|
||||
*/
|
||||
_onKeepOriginalClick: function () {
|
||||
this.trigger_up('attachment_updated', this.attachment);
|
||||
if (!this.isExisting) {
|
||||
this.trigger_up('attachment_updated', this.attachment);
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -390,7 +390,11 @@ var FileWidget = SearchableMediaWidget.extend({
|
||||
});
|
||||
optimizeDialog.on('closed', self, function () {
|
||||
self.noSave = true;
|
||||
resolve(attachment);
|
||||
if (isExisting) {
|
||||
reject();
|
||||
} else {
|
||||
resolve(attachment);
|
||||
}
|
||||
});
|
||||
});
|
||||
var always = function () {
|
||||
|
||||
Reference in New Issue
Block a user