@@ -27,13 +27,16 @@ 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) {
|
||||
public function __construct($appName, IRequest $request, AttachmentService $attachmentService, AttachmentMapper $attachmentMapper) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->attachmentService = $attachmentService;
|
||||
$this->attachmentMapper = $attachmentMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +52,13 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user