Update ActivityPub helpers, fix comment threading in statusFetch() method

This commit is contained in:
Daniel Supernault 2021-07-08 21:30:59 -06:00
parent 9650b668e9
commit 26b9c1401c
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
2 changed files with 13 additions and 3 deletions

View File

@ -321,13 +321,18 @@ class SearchController extends Controller
if(Status::whereUri($tag)->whereLocal(false)->exists()) {
$item = Status::whereUri($tag)->first();
$media = $item->firstMedia();
$url = null;
if($media) {
$url = $media->remote_url;
}
$this->tokens['posts'] = [[
'count' => 0,
'url' => "/i/web/post/_/$item->profile_id/$item->id",
'type' => 'status',
'username' => $item->profile->username,
'caption' => $item->rendered ?? $item->caption,
'thumb' => $item->firstMedia()->remote_url,
'thumb' => $url,
'timestamp' => $item->created_at->diffForHumans()
]];
}
@ -336,13 +341,18 @@ class SearchController extends Controller
if(isset($remote['type']) && $remote['type'] == 'Note') {
$item = Helpers::statusFetch($tag);
$media = $item->firstMedia();
$url = null;
if($media) {
$url = $media->remote_url;
}
$this->tokens['posts'] = [[
'count' => 0,
'url' => "/i/web/post/_/$item->profile_id/$item->id",
'type' => 'status',
'username' => $item->profile->username,
'caption' => $item->rendered ?? $item->caption,
'thumb' => $item->firstMedia()->remote_url,
'thumb' => $url,
'timestamp' => $item->created_at->diffForHumans()
]];
}

View File

@ -351,7 +351,7 @@ class Helpers {
}
$profile = self::profileFirstOrNew($activity['object']['attributedTo']);
if(isset($activity['object']['inReplyTo']) && !empty($activity['object']['inReplyTo']) && $replyTo == true) {
if(isset($activity['object']['inReplyTo']) && !empty($activity['object']['inReplyTo']) || $replyTo == true) {
$reply_to = self::statusFirstOrFetch($activity['object']['inReplyTo'], false);
$reply_to = optional($reply_to)->id;
} else {