mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update StatusActivityPubDeliver job
This commit is contained in:
parent
908740b46f
commit
0621b38bb0
1 changed files with 16 additions and 0 deletions
|
@ -8,6 +8,10 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use League\Fractal;
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use App\Transformer\ActivityPub\Verb\CreateNote;
|
||||
use App\Util\ActivityPub\Helpers;
|
||||
|
||||
class StatusActivityPubDeliver implements ShouldQueue
|
||||
{
|
||||
|
@ -34,6 +38,18 @@ class StatusActivityPubDeliver implements ShouldQueue
|
|||
{
|
||||
$status = $this->status;
|
||||
|
||||
$audience = $status->profile->getAudienceInbox();
|
||||
$profile = $status->profile;
|
||||
|
||||
$fractal = new Fractal\Manager();
|
||||
$fractal->setSerializer(new ArraySerializer());
|
||||
$resource = new Fractal\Resource\Item($status, new CreateNote());
|
||||
$activity = $fractal->createData($resource)->toArray();
|
||||
|
||||
foreach($audience as $url) {
|
||||
Helpers::sendSignedObject($profile, $url, $activity);
|
||||
}
|
||||
|
||||
// todo: fanout on write
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue