From 059711f28acceddc85966660204495d661829b75 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Fri, 18 Jan 2019 14:45:56 -0100 Subject: add attachment and parent_id field Signed-off-by: Maxence Lange --- lib/Db/NotesRequest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/Db/NotesRequest.php') 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) { + } } -- cgit v1.2.3 From 1bd6e3f44f93669ea87501601224de0c9613fb8e Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 5 Mar 2019 16:25:08 -0100 Subject: fixing & cleaning Signed-off-by: Maxence Lange --- lib/Db/NotesRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Db/NotesRequest.php') diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php index 35d99c3f..88396995 100644 --- a/lib/Db/NotesRequest.php +++ b/lib/Db/NotesRequest.php @@ -73,7 +73,7 @@ class NotesRequest extends NotesRequestBuilder { ) ->setValue( 'attachments', $qb->createNamedParameter( - json_encode($note->getAttachments(), JSON_UNESCAPED_SLASHES) + json_encode($stream->getAttachments(), JSON_UNESCAPED_SLASHES) ) ); } -- cgit v1.2.3