From 5f3969460b1f3576e92bb09b3e69f19854a83591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Wed, 13 Dec 2023 07:13:17 +0100 Subject: [PATCH] IBX-7333: Applied code review suggestions --- src/bundle/Controller/User/ProfileEditController.php | 9 +++++---- src/bundle/Resources/config/services/user_profile.yaml | 2 -- src/bundle/Resources/public/scss/_user-profile.scss | 6 +++--- .../Resources/translations/ibexa_admin_ui.en.xliff | 5 ----- .../views/themes/admin/account/profile/view.html.twig | 2 +- .../ui-dev/src/modules/common/user-name/user.name.js | 3 ++- src/lib/Menu/UserMenuBuilder.php | 3 --- src/lib/UI/Config/Provider/UserProfile.php | 2 +- 8 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/bundle/Controller/User/ProfileEditController.php b/src/bundle/Controller/User/ProfileEditController.php index 03663c3a5e..9720e7696b 100644 --- a/src/bundle/Controller/User/ProfileEditController.php +++ b/src/bundle/Controller/User/ProfileEditController.php @@ -23,6 +23,7 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Base\Exceptions\UnauthorizedException as CoreUnauthorizedException; use Symfony\Component\Form\Form; @@ -104,11 +105,11 @@ public function editAction(Request $request, ?string $languageCode) } } - $location = $this->repository->sudo(function () use ($user) { - return $this->locationService->loadLocation( + $location = $this->repository->sudo( + fn (): Location => $this->locationService->loadLocation( (int)$user->versionInfo->contentInfo->mainLocationId - ); - }); + ) + ); $parentLocation = null; try { diff --git a/src/bundle/Resources/config/services/user_profile.yaml b/src/bundle/Resources/config/services/user_profile.yaml index bd58dd0bb9..972a793139 100644 --- a/src/bundle/Resources/config/services/user_profile.yaml +++ b/src/bundle/Resources/config/services/user_profile.yaml @@ -13,5 +13,3 @@ services: decorates: Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList arguments: $innerService: '@.inner' - - diff --git a/src/bundle/Resources/public/scss/_user-profile.scss b/src/bundle/Resources/public/scss/_user-profile.scss index daf55a0c21..fba3b9b289 100644 --- a/src/bundle/Resources/public/scss/_user-profile.scss +++ b/src/bundle/Resources/public/scss/_user-profile.scss @@ -17,8 +17,8 @@ border-radius: 50%; &--img { - width: 220px; - height: 220px; + width: calculateRem(220px); + height: calculateRem(220px); } } } @@ -41,7 +41,7 @@ } &__aside { - width: 590px; + width: calculateRem(590px); margin-right: calculateRem(20px); .ibexa-user-profile-summary { diff --git a/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff b/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff index 657f29b092..8797c103dd 100644 --- a/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff +++ b/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff @@ -21,11 +21,6 @@ Select language key: edit_translation.list.title - - User profile - User profile - key: profile.view.title - Removed '%languageCode%' translation from '%name%'. Removed '%languageCode%' translation from '%name%'. diff --git a/src/bundle/Resources/views/themes/admin/account/profile/view.html.twig b/src/bundle/Resources/views/themes/admin/account/profile/view.html.twig index 6a8ecc5dc9..d3f1e2f978 100644 --- a/src/bundle/Resources/views/themes/admin/account/profile/view.html.twig +++ b/src/bundle/Resources/views/themes/admin/account/profile/view.html.twig @@ -6,7 +6,7 @@ {% block breadcrumbs %} {% include '@ibexadesign/ui/breadcrumbs.html.twig' with { items: [ - { value: 'profile.view.title'|trans|desc('User profile') } + { value: 'user_profile.view.title'|trans|desc('User profile') } ]} %} {% endblock %} diff --git a/src/bundle/ui-dev/src/modules/common/user-name/user.name.js b/src/bundle/ui-dev/src/modules/common/user-name/user.name.js index d2add4450c..f18c263d6b 100644 --- a/src/bundle/ui-dev/src/modules/common/user-name/user.name.js +++ b/src/bundle/ui-dev/src/modules/common/user-name/user.name.js @@ -6,8 +6,9 @@ const { Routing, ibexa } = window; const isUserProfileEnabled = (contentType) => { const config = ibexa.adminUiConfig.userProfile; + if (config.enabled) { - return config.contentType.contains(contentType); + return config.contentTypes.includes(contentType); } return false; diff --git a/src/lib/Menu/UserMenuBuilder.php b/src/lib/Menu/UserMenuBuilder.php index 410d38d556..e50df20885 100644 --- a/src/lib/Menu/UserMenuBuilder.php +++ b/src/lib/Menu/UserMenuBuilder.php @@ -114,9 +114,6 @@ public function createStructure(array $options): ItemInterface return $menu; } - /** - * @return \JMS\TranslationBundle\Model\Message[] - */ public static function getTranslationMessages(): array { return [ diff --git a/src/lib/UI/Config/Provider/UserProfile.php b/src/lib/UI/Config/Provider/UserProfile.php index c8caa087ff..51187ad572 100644 --- a/src/lib/UI/Config/Provider/UserProfile.php +++ b/src/lib/UI/Config/Provider/UserProfile.php @@ -27,7 +27,7 @@ public function getConfig(): array { return [ 'enabled' => $this->configuration->isEnabled(), - 'content_types' => $this->configuration->getContentTypes(), + 'contentTypes' => $this->configuration->getContentTypes(), ]; } }