Skip to content

Commit 1132e60

Browse files
committed
Check if displayed asset still exists
1 parent a7cbe9e commit 1132e60

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

AdobeStockImageAdminUi/Model/Asset/GetMediaGalleryAssetByAdobeId.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ public function __construct(
5858
*/
5959
public function execute(int $adobeId): array
6060
{
61-
$mediaGalleryId = $this->getAssetByAdobeId->execute([$adobeId])[$adobeId]->getMediaGalleryId();
61+
$mediaGalleryAsset = $this->getAssetByAdobeId->execute([$adobeId]);
62+
63+
if (!isset($mediaGalleryAsset[$adobeId])) {
64+
return [];
65+
}
66+
67+
$mediaGalleryId = $mediaGalleryAsset[$adobeId]->getMediaGalleryId();
6268
$asset = $this->getMediaGalleryAssetsById->execute([$mediaGalleryId]);
6369

6470
return $this->objectProcessor->buildOutputDataArray(current($asset), AssetInterface::class);

AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,18 @@ define([
6363
this._super().initView();
6464
$(window).on('fileDeleted.enhancedMediaGallery', function () {
6565
this.reloadAdobeGrid();
66-
this.hide();
6766
}.bind(this));
6867
$(window).on('folderDeleted.enhancedMediaGallery', function () {
68+
this.actions().getAssetDetails(this.displayedRecord().id).then(function (assetDetails) {
69+
var record = this.displayedRecord();
70+
71+
if (assetDetails.length === 0) {
72+
record['is_downloaded'] = 0;
73+
this.displayedRecord(record);
74+
}
75+
}.bind(this));
76+
6977
this.reloadAdobeGrid();
70-
this.hide();
7178
}.bind(this));
7279

7380
return this;

0 commit comments

Comments
 (0)