From d7768344c4e165c773bfe07ea6eaf127378d7e77 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 18 Mar 2024 15:15:35 +0100 Subject: [PATCH] IBX-7954: Applied review remark --- .../js/scripts/fieldType/ezimageasset.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js index 2fcc436471..7c1d583098 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js @@ -98,6 +98,18 @@ return field.fieldDefinitionIdentifier === imageAssetMapping['contentFieldIdentifier']; }); + if (imageField.fieldValue === null) { + showErrorNotification( + Translator.trans( + /* @Desc("The chosen asset has no image data available.") */ 'ezimageasset.empty_data.message.error', + {}, + 'fieldtypes_preview' + ) + ); + + return; + } + this.updateData( response.ContentInfo.Content._id, response.ContentInfo.Content.TranslatedName, @@ -126,18 +138,6 @@ * @param {Object} image */ updateData(destinationContentId, destinationContentName, destinationLocationId, image) { - if (image === null) { - showErrorNotification( - Translator.trans( - /* @Desc("The chosen asset has no image data available.") */ 'ezimageasset.empty_data.message.error', - {}, - 'fieldtypes_preview' - ) - ); - - return; - } - const preview = this.fieldContainer.querySelector('.ez-field-edit__preview'); const previewVisual = preview.querySelector('.ez-field-edit-preview__visual'); const previewImg = preview.querySelector('.ez-field-edit-preview__media');