2021-08-05 02:29:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Transformer\ActivityPub\Verb;
|
|
|
|
|
|
|
|
use App\Status;
|
|
|
|
use League\Fractal;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
class CreateQuestion extends Fractal\TransformerAbstract
|
|
|
|
{
|
|
|
|
protected $defaultIncludes = [
|
|
|
|
'object',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function transform(Status $status)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'@context' => [
|
|
|
|
'https://w3id.org/security/v1',
|
2022-05-14 15:31:47 +00:00
|
|
|
'https://www.w3.org/ns/activitystreams',
|
2021-08-05 02:29:21 +00:00
|
|
|
[
|
|
|
|
'Hashtag' => 'as:Hashtag',
|
|
|
|
'sensitive' => 'as:sensitive',
|
2022-05-16 08:26:46 +00:00
|
|
|
'schema' => 'http://schema.org/',
|
|
|
|
'pixelfed' => 'http://pixelfed.org/ns#',
|
2022-05-14 15:31:47 +00:00
|
|
|
'commentsEnabled' => [
|
2022-05-16 08:26:46 +00:00
|
|
|
'@id' => 'pixelfed:commentsEnabled',
|
2022-05-14 15:31:47 +00:00
|
|
|
'@type' => 'schema:Boolean'
|
|
|
|
],
|
|
|
|
'capabilities' => [
|
2022-05-16 08:26:46 +00:00
|
|
|
'@id' => 'pixelfed:capabilities',
|
|
|
|
'@container' => '@set'
|
2022-05-14 15:31:47 +00:00
|
|
|
],
|
2022-05-16 08:26:46 +00:00
|
|
|
'announce' => [
|
|
|
|
'@id' => 'pixelfed:canAnnounce',
|
|
|
|
'@type' => '@id'
|
2022-05-14 15:31:47 +00:00
|
|
|
],
|
2022-05-16 08:26:46 +00:00
|
|
|
'like' => [
|
|
|
|
'@id' => 'pixelfed:canLike',
|
|
|
|
'@type' => '@id'
|
2022-05-14 15:31:47 +00:00
|
|
|
],
|
2022-05-16 08:26:46 +00:00
|
|
|
'reply' => [
|
|
|
|
'@id' => 'pixelfed:canReply',
|
|
|
|
'@type' => '@id'
|
2022-05-14 09:24:40 +00:00
|
|
|
],
|
2022-05-14 15:31:47 +00:00
|
|
|
'toot' => 'http://joinmastodon.org/ns#',
|
|
|
|
'Emoji' => 'toot:Emoji'
|
2021-08-05 02:29:21 +00:00
|
|
|
]
|
|
|
|
],
|
|
|
|
'id' => $status->permalink(),
|
|
|
|
'type' => 'Create',
|
|
|
|
'actor' => $status->profile->permalink(),
|
|
|
|
'published' => $status->created_at->toAtomString(),
|
|
|
|
'to' => $status->scopeToAudience('to'),
|
|
|
|
'cc' => $status->scopeToAudience('cc'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function includeObject(Status $status)
|
|
|
|
{
|
|
|
|
return $this->item($status, new Question());
|
|
|
|
}
|
|
|
|
}
|