diff --git a/lib/Capabilities.php b/lib/Capabilities.php index c44966a4c..491b5a7fc 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -53,8 +53,7 @@ class Capabilities implements ICapability { 'canCreateBoards' => $this->permissionService->canCreate(), 'apiVersions' => [ '1.0', - '1.1', - '1.2' + '1.1' ] ] ]; diff --git a/lib/Controller/AttachmentApiController.php b/lib/Controller/AttachmentApiController.php index 244d97abd..debf93f6f 100644 --- a/lib/Controller/AttachmentApiController.php +++ b/lib/Controller/AttachmentApiController.php @@ -27,16 +27,13 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; use OCA\Deck\Service\AttachmentService; -use OCA\Deck\Db\AttachmentMapper; class AttachmentApiController extends ApiController { private $attachmentService; - private $attachmentMapper; - public function __construct($appName, IRequest $request, AttachmentService $attachmentService, AttachmentMapper $attachmentMapper) { + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { parent::__construct($appName, $request); $this->attachmentService = $attachmentService; - $this->attachmentMapper = $attachmentMapper; } /** @@ -52,13 +49,6 @@ class AttachmentApiController extends ApiController { return $attachment->getType() === 'deck_file'; }); } - - if ($apiVersion === '1.2') { - foreach ($attachment as &$attachment) { - $this->attachmentMapper->mapOwner($attachment); - } - } - return new DataResponse($attachment, HTTP::STATUS_OK); } diff --git a/lib/Controller/AttachmentController.php b/lib/Controller/AttachmentController.php index 979200271..38334199a 100644 --- a/lib/Controller/AttachmentController.php +++ b/lib/Controller/AttachmentController.php @@ -26,31 +26,22 @@ namespace OCA\Deck\Controller; use OCA\Deck\Service\AttachmentService; use OCP\AppFramework\Controller; use OCP\IRequest; -use OCA\Deck\Db\AttachmentMapper; class AttachmentController extends Controller { /** @var AttachmentService */ private $attachmentService; - private $attachmentMapper; - public function __construct($appName, IRequest $request, AttachmentService $attachmentService, AttachmentMapper $attachmentMapper) { + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { parent::__construct($appName, $request); $this->attachmentService = $attachmentService; - $this->attachmentMapper = $attachmentMapper; } /** * @NoAdminRequired */ public function getAll($cardId) { - $attachments = $this->attachmentService->findAll($cardId, true); - - foreach ($attachments as &$attachment) { - $this->attachmentMapper->mapOwner($attachment); - } - - return $attachments; + return $this->attachmentService->findAll($cardId, true); } /** diff --git a/lib/Db/AttachmentMapper.php b/lib/Db/AttachmentMapper.php index 07a294a8d..727e3cce1 100644 --- a/lib/Db/AttachmentMapper.php +++ b/lib/Db/AttachmentMapper.php @@ -156,14 +156,4 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper { } return $this->cardMapper->findBoardId($attachment->getCardId()); } - - public function mapOwner(Attachment &$attachment) { - $attachment->resolveRelation('createdBy', function ($userId) { - $user = $this->userManager->get($userId); - if ($user !== null) { - return new User($user); - } - return $user; - }); - } } diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php index b563f0bcf..bf79217cd 100644 --- a/lib/Service/AttachmentService.php +++ b/lib/Service/AttachmentService.php @@ -60,6 +60,7 @@ class AttachmentService { private $activityManager; /** @var ChangeHelper */ private $changeHelper; + /** @var IUserManager */ private IUserManager $userManager; /** @var AttachmentServiceValidator */ private AttachmentServiceValidator $attachmentServiceValidator; @@ -71,6 +72,7 @@ class AttachmentService { ChangeHelper $changeHelper, PermissionService $permissionService, Application $application, + ICacheFactory $cacheFactory, AttachmentCacheHelper $attachmentCacheHelper, $userId, IL10N $l10n,