From c8f0f61f51f6b5026de3385846c821da5230f100 Mon Sep 17 00:00:00 2001 From: Dawid Parafinski Date: Wed, 18 Sep 2024 16:13:16 +0200 Subject: [PATCH] IBX-8534: Dropped usage of deprecated contentService::loadContentDrafts method --- src/lib/Server/Controller/User.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/Server/Controller/User.php b/src/lib/Server/Controller/User.php index a472eb6df..a16c07ec6 100644 --- a/src/lib/Server/Controller/User.php +++ b/src/lib/Server/Controller/User.php @@ -17,7 +17,9 @@ use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\DraftList\ContentDraftListItemInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\User as RepositoryUser; use Ibexa\Contracts\Core\Repository\Values\User\UserGroupRoleAssignment; use Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment; @@ -577,11 +579,17 @@ public function loadUserGroupsAssignedToRole($roleId): array */ public function loadUserDrafts(int $userId, Request $request): Values\VersionList { - $contentDrafts = $this->contentService->loadContentDrafts( + $contentDrafts = $this->contentService->loadContentDraftList( $this->userService->loadUser($userId) ); - return new Values\VersionList($contentDrafts, $request->getPathInfo()); + return new Values\VersionList( + array_map( + static fn (ContentDraftListItemInterface $draftListItem): VersionInfo => $draftListItem->getVersionInfo(), + $contentDrafts->items + ), + $request->getPathInfo() + ); } /**