From ad73e0998a28b8d9ad8a80bccbb7939b714dc985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Tue, 10 Oct 2023 12:54:20 +0200 Subject: [PATCH 1/2] IBX-6729: Drafts should be removed from user menu --- .../translations/ibexa_menu.en.xliff | 5 ----- src/lib/Menu/UserMenuBuilder.php | 19 ------------------- 2 files changed, 24 deletions(-) diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index f06687ea84..8d9f5d09af 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -531,11 +531,6 @@ Logout key: user__content - - Drafts - Drafts - key: user__drafts - User settings User settings diff --git a/src/lib/Menu/UserMenuBuilder.php b/src/lib/Menu/UserMenuBuilder.php index 4b20bd56fd..fa4a62c3fc 100644 --- a/src/lib/Menu/UserMenuBuilder.php +++ b/src/lib/Menu/UserMenuBuilder.php @@ -10,7 +10,6 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; -use Ibexa\Contracts\Core\Repository\PermissionResolver; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -27,25 +26,19 @@ class UserMenuBuilder extends AbstractBuilder implements TranslationContainerInt public const ITEM_LOGOUT = 'user__content'; public const ITEM_USER_SETTINGS = 'user__settings'; public const ITEM_BOOKMARK = 'user__bookmark'; - public const ITEM_DRAFTS = 'user__drafts'; public const ITEM_NOTIFICATION = 'menu.notification'; /** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */ private $tokenStorage; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; - public function __construct( MenuItemFactory $factory, EventDispatcherInterface $eventDispatcher, TokenStorageInterface $tokenStorage, - PermissionResolver $permissionResolver ) { parent::__construct($factory, $eventDispatcher); $this->tokenStorage = $tokenStorage; - $this->permissionResolver = $permissionResolver; } /** @@ -69,17 +62,6 @@ public function createStructure(array $options): ItemInterface $token = $this->tokenStorage->getToken(); if (null !== $token && is_object($token->getUser())) { - if ($this->permissionResolver->hasAccess('content', 'versionread') !== false) { - $menu->addChild( - $this->createMenuItem(self::ITEM_DRAFTS, [ - 'route' => 'ibexa.content_draft.list', - 'extras' => [ - 'orderNumber' => 30, - ], - ]) - ); - } - $menu->addChild( $this->createMenuItem(self::ITEM_USER_SETTINGS, [ 'route' => 'ibexa.user_settings.list', @@ -111,7 +93,6 @@ public static function getTranslationMessages(): array return [ (new Message(self::ITEM_LOGOUT, 'ibexa_menu'))->setDesc('Logout'), (new Message(self::ITEM_USER_SETTINGS, 'ibexa_menu'))->setDesc('User settings'), - (new Message(self::ITEM_DRAFTS, 'ibexa_menu'))->setDesc('Drafts'), (new Message(self::ITEM_NOTIFICATION, 'ibexa_notifications'))->setDesc('View Notifications'), ]; } From e79ec9bf6c1cfe017730deb3efb087b15a086c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Mon, 16 Oct 2023 10:59:59 +0200 Subject: [PATCH 2/2] Update src/lib/Menu/UserMenuBuilder.php Co-authored-by: Jakub Brzegowski --- src/lib/Menu/UserMenuBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Menu/UserMenuBuilder.php b/src/lib/Menu/UserMenuBuilder.php index fa4a62c3fc..721fdab2e4 100644 --- a/src/lib/Menu/UserMenuBuilder.php +++ b/src/lib/Menu/UserMenuBuilder.php @@ -34,7 +34,7 @@ class UserMenuBuilder extends AbstractBuilder implements TranslationContainerInt public function __construct( MenuItemFactory $factory, EventDispatcherInterface $eventDispatcher, - TokenStorageInterface $tokenStorage, + TokenStorageInterface $tokenStorage ) { parent::__construct($factory, $eventDispatcher);