Merge pull request #5438 from pixelfed/staging

Staging
This commit is contained in:
daniel 2025-01-05 15:28:10 -07:00 committed by GitHub
commit dcd14aa50c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 12 deletions

View file

@ -31,6 +31,8 @@
- Update VerifyCsrfToken middleware, add oauth token. Fixes #5426 ([79ebbc2d](https://github.com/pixelfed/pixelfed/commit/79ebbc2d)) - Update VerifyCsrfToken middleware, add oauth token. Fixes #5426 ([79ebbc2d](https://github.com/pixelfed/pixelfed/commit/79ebbc2d))
- Update AdminSettingsController, increase max photo size limit from 50MB to 1GB ([aa448354](https://github.com/pixelfed/pixelfed/commit/aa448354)) - Update AdminSettingsController, increase max photo size limit from 50MB to 1GB ([aa448354](https://github.com/pixelfed/pixelfed/commit/aa448354))
- Update BearerTokenResponse, return scopes in /oauth/token endpoint. Fixes #5286 ([d8f5c302](https://github.com/pixelfed/pixelfed/commit/d8f5c302)) - Update BearerTokenResponse, return scopes in /oauth/token endpoint. Fixes #5286 ([d8f5c302](https://github.com/pixelfed/pixelfed/commit/d8f5c302))
- Update hashtag component, fix missing video thumbnails ([witten](https://github.com/witten)) ([#5427](https://github.com/pixelfed/pixelfed/pull/5427))
- Update AP Status Transformer, fix inReplyTo. Fixes #5409 ([83cc932f](https://github.com/pixelfed/pixelfed/commit/83cc932f))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev) ## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)

View file

@ -3,6 +3,7 @@
namespace App\Transformer\ActivityPub; namespace App\Transformer\ActivityPub;
use App\Services\MediaService; use App\Services\MediaService;
use App\Services\StatusService;
use App\Status; use App\Status;
use App\Util\Lexer\Autolink; use App\Util\Lexer\Autolink;
use League\Fractal; use League\Fractal;
@ -11,7 +12,16 @@ class StatusTransformer extends Fractal\TransformerAbstract
{ {
public function transform(Status $status) public function transform(Status $status)
{ {
$content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : ""; $content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : '';
$inReplyTo = null;
if ($status->in_reply_to_id) {
$reply = StatusService::get($status->in_reply_to_id, true);
if ($reply && isset($reply['url'])) {
$inReplyTo = $reply['url'];
}
}
return [ return [
'@context' => [ '@context' => [
@ -25,30 +35,20 @@ class StatusTransformer extends Fractal\TransformerAbstract
], ],
], ],
'id' => $status->url(), 'id' => $status->url(),
// TODO: handle other types
'type' => 'Note', 'type' => 'Note',
// XXX: CW Title
'summary' => null, 'summary' => null,
'content' => $content, 'content' => $content,
'inReplyTo' => null, 'inReplyTo' => $inReplyTo,
// TODO: fix date format
'published' => $status->created_at->toAtomString(), 'published' => $status->created_at->toAtomString(),
'url' => $status->url(), 'url' => $status->url(),
'attributedTo' => $status->profile->permalink(), 'attributedTo' => $status->profile->permalink(),
'to' => [ 'to' => [
// TODO: handle proper scope
'https://www.w3.org/ns/activitystreams#Public', 'https://www.w3.org/ns/activitystreams#Public',
], ],
'cc' => [ 'cc' => [
// TODO: add cc's
$status->profile->permalink('/followers'), $status->profile->permalink('/followers'),
], ],
'sensitive' => (bool) $status->is_nsfw, 'sensitive' => (bool) $status->is_nsfw,
'atomUri' => $status->url(),
'inReplyToAtomUri' => null,
'attachment' => MediaService::activitypub($status->id), 'attachment' => MediaService::activitypub($status->id),
'tag' => [], 'tag' => [],
'location' => $status->place_id ? [ 'location' => $status->place_id ? [