summaryrefslogtreecommitdiffstats
path: root/lib/Db/NotesRequest.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-03-14 04:59:47 +0100
committerGitHub <noreply@github.com>2019-03-14 04:59:47 +0100
commit26c2ec4081470c018a1ebe85dea6afeedc7c3e1c (patch)
tree0219c076d8499b272a283e0e83bf977f013035c2 /lib/Db/NotesRequest.php
parent952e9dd4ed098428c1a9715485bfbe5bc3c5d804 (diff)
parent1bd6e3f44f93669ea87501601224de0c9613fb8e (diff)
Merge pull request #352 from nextcloud/feature/noid/attachments
Incoming Attachments.
Diffstat (limited to 'lib/Db/NotesRequest.php')
-rw-r--r--lib/Db/NotesRequest.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php
index db50bd58..4f44415a 100644
--- a/lib/Db/NotesRequest.php
+++ b/lib/Db/NotesRequest.php
@@ -32,6 +32,7 @@ namespace OCA\Social\Db;
use daita\MySmallPhpTools\Model\Cache;
use DateTime;
+use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCA\Social\Exceptions\NoteNotFoundException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
@@ -69,7 +70,12 @@ class NotesRequest extends NotesRequestBuilder {
/** @var Note $stream */
$qb->setValue(
'hashtags', $qb->createNamedParameter(json_encode($stream->getHashtags()))
- );
+ )
+ ->setValue(
+ 'attachments', $qb->createNamedParameter(
+ json_encode($stream->getAttachments(), JSON_UNESCAPED_SLASHES)
+ )
+ );
}
$qb->execute();
@@ -86,7 +92,10 @@ class NotesRequest extends NotesRequestBuilder {
$this->limitToIdString($qb, $stream->getId());
- $qb->execute();
+ try {
+ $qb->execute();
+ } catch (UniqueConstraintViolationException $e) {
+ }
}