status = $status; $this->mention = $mention; } /** * Execute the job. * * @return void */ public function handle() { $status = $this->status; $mention = $this->mention; // Verify status exists if (! $status) { Log::info('MentionPipeline: Status no longer exists, skipping job'); return; } // Verify mention exists if (! $mention) { Log::info('MentionPipeline: Mention no longer exists, skipping job'); return; } $actor = $status->profile; $target = $mention->profile_id; // Verify actor profile exists if (! $actor) { Log::info("MentionPipeline: Actor profile no longer exists for status {$status->id}, skipping job"); return; } // Verify target profile ID exists if (! $target) { Log::info("MentionPipeline: Target profile ID missing for mention {$mention->id}, skipping job"); return; } $exists = Notification::whereProfileId($target) ->whereActorId($actor->id) ->whereIn('action', ['mention', 'comment']) ->whereItemId($status->id) ->whereItemType(Status::class) ->count(); if ($actor->id === $target || $exists !== 0) { return; } NotificationService::firstOrCreateNotification($target, $actor->id, 'mention', $status->id, Status::class); StatusService::del($status->id); if (NotificationAppGatewayService::enabled()) { if (PushNotificationService::check('mention', $target)) { $user = User::whereProfileId($target)->first(); if ($user && $user->expo_token && $user->notify_enabled) { MentionPushNotifyPipeline::dispatch($user->expo_token, $actor->username)->onQueue('pushnotify'); } } } } }