summaryrefslogtreecommitdiffstats
path: root/lib/Db/NotesRequest.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-01-18 14:45:56 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-01-19 11:14:38 -0100
commit059711f28acceddc85966660204495d661829b75 (patch)
tree46bca8b21ebd39a6e76eb0a688a8eb034209243e /lib/Db/NotesRequest.php
parent75feeaf24e6c0b5083c8fded5198c199bd3fb7bd (diff)
add attachment and parent_id field
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Db/NotesRequest.php')
-rw-r--r--lib/Db/NotesRequest.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php
index 306c85ff..4d8221c8 100644
--- a/lib/Db/NotesRequest.php
+++ b/lib/Db/NotesRequest.php
@@ -31,6 +31,7 @@ namespace OCA\Social\Db;
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;
@@ -87,6 +88,11 @@ class NotesRequest extends NotesRequestBuilder {
)
->setValue('content', $qb->createNamedParameter($note->getContent()))
->setValue('summary', $qb->createNamedParameter($note->getSummary()))
+ ->setValue(
+ 'attachments', $qb->createNamedParameter(
+ json_encode($note->getAttachments(), JSON_UNESCAPED_SLASHES)
+ )
+ )
->setValue('published', $qb->createNamedParameter($note->getPublished()))
->setValue(
'published_time', $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
@@ -105,7 +111,10 @@ class NotesRequest extends NotesRequestBuilder {
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
- $qb->execute();
+ try {
+ $qb->execute();
+ } catch (UniqueConstraintViolationException $e) {
+ }
}