diff --git a/lib/Interfaces/Object/AnnounceInterface.php b/lib/Interfaces/Object/AnnounceInterface.php index 31495534..b3748c7d 100644 --- a/lib/Interfaces/Object/AnnounceInterface.php +++ b/lib/Interfaces/Object/AnnounceInterface.php @@ -319,7 +319,9 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit /** @var SocialAppNotification $notification */ $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); // $notification->setDetail('url', ''); + $notification->setDetailItem('post', $post); + $notification->setDetailInt('nid', $post->getNid()); $notification->addDetail('accounts', $author->getAccount()); $notification->setAttributedTo($author->getId()) ->setSubType(Announce::TYPE) diff --git a/lib/Interfaces/Object/LikeInterface.php b/lib/Interfaces/Object/LikeInterface.php index 4f2dbb25..226c3cd1 100644 --- a/lib/Interfaces/Object/LikeInterface.php +++ b/lib/Interfaces/Object/LikeInterface.php @@ -204,6 +204,7 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); // $notification->setDetail('url', ''); $notification->setDetailItem('post', $post); + $notification->setDetailInt('nid', $post->getNid()); $notification->addDetail('accounts', $author->getAccount()); $notification->setAttributedTo($author->getId()) ->setSubType(Like::TYPE) diff --git a/lib/Model/ActivityPub/Stream.php b/lib/Model/ActivityPub/Stream.php index 7373b93b..df0b1741 100644 --- a/lib/Model/ActivityPub/Stream.php +++ b/lib/Model/ActivityPub/Stream.php @@ -495,7 +495,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { parent::importFromCache($data); $actor = new Person(); - $actor->importFromCache($data['actor_info']); + $actor->importFromCache($data['actor_info'] ?? []); $this->setActor($actor); $this->setCompleteDetails(true); } @@ -605,16 +605,16 @@ class Stream extends ACore implements IQueryRow, JsonSerializable { } $status = null; - if ($statusPost = $this->getDetails('post')) { - if (sizeof($statusPost) > 0) { - $status = new Stream(); - $status->importFromCache($statusPost); - $status->setExportFormat(self::FORMAT_LOCAL); - } + $statusPost = $this->getDetails('post'); + if (sizeof($statusPost) > 0) { + $status = new Stream(); + $status->importFromCache($statusPost); + $status->setNid($this->getDetailInt('nid')); + $status->setExportFormat(self::FORMAT_LOCAL); } $result = [ - 'id' => $this->getId(), + 'id' => (string)$this->getNid(), 'type' => $type, 'created_at' => $this->getOriginCreationTime(), 'status' => $status, diff --git a/lib/Traits/TDetails.php b/lib/Traits/TDetails.php index ac0ad2be..7a78a545 100644 --- a/lib/Traits/TDetails.php +++ b/lib/Traits/TDetails.php @@ -113,6 +113,10 @@ trait TDetails { } + public function getDetailInt(string $detail, int $default = 0): int { + return $this->details[$detail] ?? $default; + } + /** * @param string $detail * @param string $value