diff options
author | Robin Appelman <robin@icewind.nl> | 2020-10-15 19:09:53 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-10-19 18:25:06 +0200 |
commit | dd9ed2f972b259ef39df0130cd58b58d94c530d3 (patch) | |
tree | dde61e1ea5a82d3e622eee8e5dab1187d7820273 /lib | |
parent | cd86386bffe0911fa8879735a3b18540c50ed71c (diff) |
set reblogged and favorited in mastadon api
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Model/ActivityPub/Stream.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Model/ActivityPub/Stream.php b/lib/Model/ActivityPub/Stream.php index a731f2f6..c01660c7 100644 --- a/lib/Model/ActivityPub/Stream.php +++ b/lib/Model/ActivityPub/Stream.php @@ -480,6 +480,21 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { * @return array */ public function exportAsLocal(): array { + $actions = ($this->hasAction()) ? $this->getAction()->getValues() : []; + $favorited = false; + $reblogged = false; + foreach ($actions as $action => $value) { + if ($value) { + switch ($action) { + case StreamAction::BOOSTED: + $reblogged = true; + break; + case StreamAction::LIKED: + $favorited = true; + break; + } + } + } $result = [ "content" => $this->getContent(), "sensitive" => $this->isSensitive(), @@ -491,8 +506,8 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { 'replies_count' => 0, 'reblogs_count' => 0, 'favourites_count' => 0, - 'favourited' => false, - 'reblogged' => false, + 'favourited' => $favorited, + 'reblogged' => $reblogged, 'muted' => false, 'bookmarked' => false, 'uri' => $this->getId(), |