summaryrefslogtreecommitdiffstats
path: root/lib/Model/ActivityPub/Object/Note.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-02-23 11:06:39 -0100
committerMaxence Lange <maxence@artificial-owl.com>2023-02-23 11:06:52 -0100
commit0298fb6294ba4cec801c85802d904a39afa7a6e5 (patch)
tree7a0aed384d4cbdb7f83ba52c804fe74373d0b033 /lib/Model/ActivityPub/Object/Note.php
parent4753bca888e315a15ebf9cccb1b1fe9a94428160 (diff)
add media_attachments to api
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Model/ActivityPub/Object/Note.php')
-rw-r--r--lib/Model/ActivityPub/Object/Note.php56
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);