diff options
Diffstat (limited to 'lib/Model/ActivityPub/Object/Note.php')
-rw-r--r-- | lib/Model/ActivityPub/Object/Note.php | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/lib/Model/ActivityPub/Object/Note.php b/lib/Model/ActivityPub/Object/Note.php index 08985252..1cd4701f 100644 --- a/lib/Model/ActivityPub/Object/Note.php +++ b/lib/Model/ActivityPub/Object/Note.php @@ -42,7 +42,6 @@ use OCA\Social\Model\ActivityPub\Stream; class Note extends Stream implements JsonSerializable { public const TYPE = 'Note'; - private array $attachments = []; private array $hashtags = []; public function __construct(ACore $parent = null) { @@ -51,16 +50,6 @@ class Note extends Stream implements JsonSerializable { $this->setType(self::TYPE); } - public function getAttachments(): array { - return $this->attachments; - } - - public function setAttachments(array $attachments): Note { - $this->attachments = $attachments; - - return $this; - } - public function getHashtags(): array { return $this->hashtags; } @@ -92,57 +81,13 @@ class Note extends Stream implements JsonSerializable { public function import(array $data): void { parent::import($data); - $this->importAttachments($this->getArray('attachment', $data, [])); $this->fillHashtags(); } - /** - * @throws ItemAlreadyExistsException - */ - public function importAttachments(array $list): void { - $new = []; - foreach ($list as $item) { - try { - $attachment = AP::$activityPub->getItemFromData($item, $this); - } catch (Exception $e) { - continue; - } - - if ($attachment->getType() !== Document::TYPE - && $attachment->getType() !== Image::TYPE) { - continue; - } - - try { - $attachment->setUrl( - $this->validateEntryString(ACore::AS_URL, $attachment->getUrl()) - ); - } catch (InvalidResourceEntryException $e) { - continue; - } - - if ($attachment->getUrl() === '') { - continue; - } - - try { - $interface = AP::$activityPub->getInterfaceFromType($attachment->getType()); - } catch (ItemUnknownException $e) { - continue; - } - - $interface->save($attachment); - $new[] = $attachment; - } - - $this->setAttachments($new); - } - public function importFromDatabase(array $data): void { parent::importFromDatabase($data); - $this->setAttachments($this->getArray('attachments', $data, [])); $this->setHashtags($this->getArray('hashtags', $data, [])); } @@ -151,7 +96,6 @@ class Note extends Stream implements JsonSerializable { if ($this->isCompleteDetails()) { $result['hashtags'] = $this->getHashtags(); - $result['attachment'] = $this->getAttachments(); } $this->cleanArray($result); |