summaryrefslogtreecommitdiffstats
path: root/lib/Service/DocumentService.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-07-11 22:43:51 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-07-11 22:43:51 -0100
commitb8f3525600c6d47d088846083e301d233d0fd4cb (patch)
tree54f76217dc8ad6600aa6017dce71bad6dce1f17f /lib/Service/DocumentService.php
parent623facfb04972f97030a64f9e6c1b63a1c2a3b9c (diff)
update cache in stream
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Service/DocumentService.php')
-rw-r--r--lib/Service/DocumentService.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php
index d860a018..4fedac0c 100644
--- a/lib/Service/DocumentService.php
+++ b/lib/Service/DocumentService.php
@@ -36,9 +36,11 @@ use Exception;
use OCA\Social\AP;
use OCA\Social\Db\ActorsRequest;
use OCA\Social\Db\CacheDocumentsRequest;
+use OCA\Social\Db\StreamRequest;
use OCA\Social\Exceptions\CacheContentException;
use OCA\Social\Exceptions\CacheContentMimeTypeException;
use OCA\Social\Exceptions\CacheDocumentDoesNotExistException;
+use OCA\Social\Exceptions\ItemAlreadyExistsException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\RequestContentException;
use OCA\Social\Exceptions\RequestNetworkException;
@@ -74,6 +76,8 @@ class DocumentService {
/** @var ActorsRequest */
private $actorRequest;
+ /** @var StreamRequest */
+ private $streamRequest;
/** @var CacheDocumentService */
private $cacheService;
@@ -91,19 +95,20 @@ class DocumentService {
* @param IUrlGenerator $urlGenerator
* @param CacheDocumentsRequest $cacheDocumentsRequest
* @param ActorsRequest $actorRequest
+ * @param StreamRequest $streamRequest
* @param CacheDocumentService $cacheService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct(
IUrlGenerator $urlGenerator, CacheDocumentsRequest $cacheDocumentsRequest,
- ActorsRequest $actorRequest,
- CacheDocumentService $cacheService,
- ConfigService $configService, MiscService $miscService
+ ActorsRequest $actorRequest, StreamRequest $streamRequest,
+ CacheDocumentService $cacheService, ConfigService $configService, MiscService $miscService
) {
$this->urlGenerator = $urlGenerator;
$this->cacheDocumentsRequest = $cacheDocumentsRequest;
$this->actorRequest = $actorRequest;
+ $this->streamRequest = $streamRequest;
$this->configService = $configService;
$this->cacheService = $cacheService;
$this->miscService = $miscService;
@@ -143,6 +148,8 @@ class DocumentService {
$document->setLocalCopy($localCopy);
$this->cacheDocumentsRequest->endCaching($document);
+ $this->streamRequest->updateAttachments($document);
+
return $document;
} catch (CacheContentMimeTypeException $e) {
$this->miscService->log(
@@ -234,6 +241,7 @@ class DocumentService {
* @throws SocialAppConfigException
* @throws UrlCloudException
* @throws ItemUnknownException
+ * @throws ItemAlreadyExistsException
*/
public function cacheLocalAvatarByUsername(Person $actor): string {
$url = $this->urlGenerator->linkToRouteAbsolute(