mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
986 B
PHTML
36 lines
986 B
PHTML
|
1 month ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Util\ActivityPub\Inbox;
|
||
|
|
|
||
|
|
use App\Jobs\ProfilePipeline\HandleUpdateActivity;
|
||
|
|
use App\Jobs\StatusPipeline\StatusRemoteUpdatePipeline;
|
||
|
|
use App\Status;
|
||
|
|
use App\Util\ActivityPub\Helpers;
|
||
|
|
use App\Util\ActivityPub\Validator\UpdatePersonValidator;
|
||
|
|
|
||
|
|
trait HandlesUpdates
|
||
|
|
{
|
||
|
|
public function handleUpdateActivity(): void
|
||
|
|
{
|
||
|
|
$activity = $this->payload['object'];
|
||
|
|
|
||
|
|
if (! isset($activity['type'], $activity['id'])) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (! Helpers::validateUrl($activity['id'])) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($activity['type'] === 'Note') {
|
||
|
|
if (Status::whereObjectUrl($activity['id'])->exists()) {
|
||
|
|
StatusRemoteUpdatePipeline::dispatch($activity);
|
||
|
|
}
|
||
|
|
} elseif ($activity['type'] === 'Person') {
|
||
|
|
if (UpdatePersonValidator::validate($this->payload)) {
|
||
|
|
HandleUpdateActivity::dispatch($this->payload)->onQueue('low');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|