Update StatusActivityPubDeliver job

This commit is contained in:
Daniel Supernault 2018-11-13 19:45:48 -07:00
parent 908740b46f
commit 0621b38bb0
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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
}
}