From 6eb656173704809de0eabbe96ff4463d42eb5697 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 19 Nov 2018 11:24:53 -0100 Subject: [PATCH] source verification Signed-off-by: Maxence Lange --- lib/Service/ActivityPub/FollowService.php | 1 - lib/Service/ActivityPub/NoteService.php | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Service/ActivityPub/FollowService.php b/lib/Service/ActivityPub/FollowService.php index facfef67..4b716860 100644 --- a/lib/Service/ActivityPub/FollowService.php +++ b/lib/Service/ActivityPub/FollowService.php @@ -181,7 +181,6 @@ class FollowService implements ICoreService { */ public function save(ACore $follow) { /** @var Follow $follow */ - if ($follow->isRoot()) { $follow->verify($follow->getActorId()); try { diff --git a/lib/Service/ActivityPub/NoteService.php b/lib/Service/ActivityPub/NoteService.php index e143ef01..86cefa1d 100644 --- a/lib/Service/ActivityPub/NoteService.php +++ b/lib/Service/ActivityPub/NoteService.php @@ -37,6 +37,7 @@ use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\RequestException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Model\ActivityPub\ACore; +use OCA\Social\Model\ActivityPub\Activity\Create; use OCA\Social\Model\ActivityPub\Note; use OCA\Social\Model\ActivityPub\Person; use OCA\Social\Model\InstancePath; @@ -229,7 +230,20 @@ class NoteService implements ICoreService { */ public function save(ACore $note) { /** @var Note $note */ - $this->notesRequest->save($note); + if ($note->isRoot()) { + return; + } + + $parent = $note->getParent(); + if ($parent->isRoot() === false) { + return; + } + + if ($parent->getType() === Create::TYPE) { + $parent->verify(($note->getAttributedTo())); + $this->notesRequest->save($note); + } + }