Skip to content

Commit 43fd057

Browse files
committed
Code style improvements
1 parent 8cdcefd commit 43fd057

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

app/code/Magento/MediaGalleryUi/Ui/Component/DirectoryTree.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
*/
1818
class DirectoryTree extends Container
1919
{
20-
private const ACL_DELETE_FOLDER = 'Magento_MediaGallery::delete_folder';
20+
private const ACL_IMAGE_ACTIONS = [
21+
'delete_folder' => 'Magento_MediaGallery::delete_folder'
22+
];
2123

2224
/**
2325
* @var UrlInterface
@@ -70,15 +72,17 @@ public function prepare(): void
7072
);
7173
}
7274

75+
7376
/**
7477
* Return allowed actions for media gallery
7578
*/
7679
private function getAllowedActions(): array
7780
{
7881
$allowedActions = [];
79-
80-
if ($this->authorization->isAllowed(self::ACL_DELETE_FOLDER)) {
81-
$allowedActions[] = 'delete_folder';
82+
foreach (self::ACL_IMAGE_ACTIONS as $key => $action) {
83+
if ($this->authorization->isAllowed($action)) {
84+
$allowedActions[] = $key;
85+
}
8286
}
8387

8488
return $allowedActions;

app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/actions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ define([
5757

5858
if (!this.allowedActions.includes('delete_assets')) {
5959
$.async('.media-gallery-delete-assets', function () {
60-
$('.media-gallery-delete-assets').attr('click', '#')
61-
.unbind('click')
62-
.addClass('action-disabled');
60+
$('.media-gallery-delete-assets').unbind('click').addClass('action-disabled');
6361
});
6462
}
6563

0 commit comments

Comments
 (0)