Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/1638/head
Maxence Lange 2023-03-09 14:36:01 -01:00
rodzic abb9402b57
commit 96f4b87558
4 zmienionych plików z 15 dodań i 8 usunięć

Wyświetl plik

@ -319,7 +319,9 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
/** @var SocialAppNotification $notification */ /** @var SocialAppNotification $notification */
$notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE);
// $notification->setDetail('url', ''); // $notification->setDetail('url', '');
$notification->setDetailItem('post', $post); $notification->setDetailItem('post', $post);
$notification->setDetailInt('nid', $post->getNid());
$notification->addDetail('accounts', $author->getAccount()); $notification->addDetail('accounts', $author->getAccount());
$notification->setAttributedTo($author->getId()) $notification->setAttributedTo($author->getId())
->setSubType(Announce::TYPE) ->setSubType(Announce::TYPE)

Wyświetl plik

@ -204,6 +204,7 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub
$notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE);
// $notification->setDetail('url', ''); // $notification->setDetail('url', '');
$notification->setDetailItem('post', $post); $notification->setDetailItem('post', $post);
$notification->setDetailInt('nid', $post->getNid());
$notification->addDetail('accounts', $author->getAccount()); $notification->addDetail('accounts', $author->getAccount());
$notification->setAttributedTo($author->getId()) $notification->setAttributedTo($author->getId())
->setSubType(Like::TYPE) ->setSubType(Like::TYPE)

Wyświetl plik

@ -495,7 +495,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
parent::importFromCache($data); parent::importFromCache($data);
$actor = new Person(); $actor = new Person();
$actor->importFromCache($data['actor_info']); $actor->importFromCache($data['actor_info'] ?? []);
$this->setActor($actor); $this->setActor($actor);
$this->setCompleteDetails(true); $this->setCompleteDetails(true);
} }
@ -605,16 +605,16 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
} }
$status = null; $status = null;
if ($statusPost = $this->getDetails('post')) { $statusPost = $this->getDetails('post');
if (sizeof($statusPost) > 0) { if (sizeof($statusPost) > 0) {
$status = new Stream(); $status = new Stream();
$status->importFromCache($statusPost); $status->importFromCache($statusPost);
$status->setExportFormat(self::FORMAT_LOCAL); $status->setNid($this->getDetailInt('nid'));
} $status->setExportFormat(self::FORMAT_LOCAL);
} }
$result = [ $result = [
'id' => $this->getId(), 'id' => (string)$this->getNid(),
'type' => $type, 'type' => $type,
'created_at' => $this->getOriginCreationTime(), 'created_at' => $this->getOriginCreationTime(),
'status' => $status, 'status' => $status,

Wyświetl plik

@ -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 $detail
* @param string $value * @param string $value