target = $target; $this->activity = $activity; } /** * Get the middleware the job should pass through. * * @return array */ public function middleware(): array { return [ new WithoutOverlapping('process-move-cleanup-legacy-followers:'.$this->target), (new ThrottlesExceptions(2, 5 * 60))->backoff(5), ]; } /** * Determine the time at which the job should timeout. */ public function retryUntil(): DateTime { return now()->addMinutes(15); } /** * Execute the job. */ public function handle(): void { if (config('app.env') !== 'production' || (bool) config_cache('federation.activitypub.enabled') == false) { throw new Exception('Activitypub not enabled'); } $target = $this->target; $actor = $this->activity; $targetAccount = Helpers::profileFetch($target); $actorAccount = Helpers::profileFetch($actor); if (! $targetAccount || ! $actorAccount) { throw new Exception('Invalid move accounts'); } Follower::whereFollowingId($actorAccount['id'])->delete(); } }