From efe50b58fd804e3acdd95eca14c8ef14ed4dfcf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Wed, 3 Jan 2018 14:46:19 +0100 Subject: [PATCH] EZEE-1796: Cannot load versions information on Landing Page with removed editor --- Controller/StudioUIController.php | 8 ++++++-- Resources/public/js/views/popups/ezs-versionspopupview.js | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Controller/StudioUIController.php b/Controller/StudioUIController.php index 2c10898b..e416c48b 100644 --- a/Controller/StudioUIController.php +++ b/Controller/StudioUIController.php @@ -19,7 +19,7 @@ use EzSystems\StudioUIBundle\SiteAccess\ReverseMatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; -use eZ\Publish\Core\Base\Exceptions\NotFoundException; +use eZ\Publish\API\Repository\Exceptions\NotFoundException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Bridge\Monolog\Logger; @@ -101,7 +101,11 @@ public function contentVersions(Request $request, $contentId) $ownerId = $version->creatorId; if (!isset($authors[$ownerId])) { - $authors[$ownerId] = $this->userService->loadUser($ownerId)->getVersionInfo()->getName(); + try { + $authors[$ownerId] = $this->userService->loadUser($ownerId)->getVersionInfo()->getName(); + } catch (NotFoundException $e) { + $authors[$ownerId] = null; + } } $restVersionId = $this->router->generate( diff --git a/Resources/public/js/views/popups/ezs-versionspopupview.js b/Resources/public/js/views/popups/ezs-versionspopupview.js index 7ae23c8b..252ef0ec 100644 --- a/Resources/public/js/views/popups/ezs-versionspopupview.js +++ b/Resources/public/js/views/popups/ezs-versionspopupview.js @@ -159,7 +159,7 @@ YUI.add('ezs-versionspopupview', function (Y) { }); versionsData.owners.push({ versionId: versionData.id, - value: versionData.author + value: versionData.author || this.get('missingOwnerText') }); versionsData.created.push({ versionId: versionData.id, @@ -872,6 +872,19 @@ YUI.add('ezs-versionspopupview', function (Y) { value: 'Missing {language} translation', writeOnce: 'initOnly' }, + + /** + * The missing owner information text. + * + * @attribute missingOwnerText + * @type String + * @default '-' + * @writeOnce 'initOnly' + */ + missingOwnerText: { + value: '-', + writeOnce: 'initOnly' + } } }); });