diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2023-03-15 14:23:05 -0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 14:23:05 -0100 |
commit | 804ddccb654bb827180e89ef67472496be9e8d55 (patch) | |
tree | b986be99873455f0c35f654b0c39ec701d6fe1b4 /lib/Model/ActivityPub/Stream.php | |
parent | 33af3cb7838c79551ecdf57903b52f439985840c (diff) | |
parent | ccc814521fafeb1f8f65a84f533bd79504c1937b (diff) |
Merge pull request #1657 from nextcloud/enh/noid/status-mention
add mentions to status
Diffstat (limited to 'lib/Model/ActivityPub/Stream.php')
-rw-r--r-- | lib/Model/ActivityPub/Stream.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Model/ActivityPub/Stream.php b/lib/Model/ActivityPub/Stream.php index ad55eee1..5a19deb3 100644 --- a/lib/Model/ActivityPub/Stream.php +++ b/lib/Model/ActivityPub/Stream.php @@ -78,6 +78,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { private string $attributedTo = ''; private string $inReplyTo = ''; private array $attachments = []; + private array $mentions = []; private bool $sensitive = false; private string $conversation = ''; private ?Cache $cache = null; @@ -247,6 +248,17 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { } + public function getMentions(): array { + return $this->mentions; + } + + public function setMentions(array $mentions): self { + $this->mentions = $mentions; + + return $this; + } + + /** * @return bool */ @@ -434,7 +446,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { */ public function importAttachments(array $list): void { $urlGenerator = Server::get(IURLGenerator::class); - + $new = []; foreach ($list as $item) { try { @@ -495,6 +507,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { $this->setDetailsAll($this->getArray('details', $data, [])); $this->setFilterDuplicate($this->getBool('filter_duplicate', $data, false)); $this->setAttachments($this->getArray('attachments', $data, [])); + $this->setMentions($this->getDetails('mentions')); $this->setVisibility($this->get('visibility', $data)); $cache = new Cache(); @@ -547,6 +560,8 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { } $this->setAttachments($attachments); + $this->setMentions($this->getArray('mentions', $data)); + // import from cache with new format ! $actor = new Person(); $actor->importFromLocal($this->getArray('account', $data)); @@ -619,6 +634,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { "language" => $this->getLanguage(), "in_reply_to_id" => null, "in_reply_to_account_id" => null, + 'mentions' => $this->getMentions(), 'replies_count' => 0, 'reblogs_count' => 0, 'favourites_count' => 0, |