From 63d7e4ecaaad0e8be6f4aa06f97110df77c90a25 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 14 Jan 2019 22:43:53 -0700 Subject: [PATCH] Update SharePipeline --- app/Jobs/SharePipeline/SharePipeline.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/Jobs/SharePipeline/SharePipeline.php b/app/Jobs/SharePipeline/SharePipeline.php index 4e2fbce52..6d581eb73 100644 --- a/app/Jobs/SharePipeline/SharePipeline.php +++ b/app/Jobs/SharePipeline/SharePipeline.php @@ -17,7 +17,7 @@ class SharePipeline implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - protected $like; + protected $status; /** * Delete the job if its models no longer exist. @@ -44,10 +44,10 @@ class SharePipeline implements ShouldQueue public function handle() { $status = $this->status; - $actor = $this->status->profile; - $target = $this->status->parent()->profile; + $actor = $status->profile; + $target = $status->parent()->profile; - if ($status->url !== null) { + if ($status->uri !== null) { // Ignore notifications to remote statuses return; } @@ -55,23 +55,21 @@ class SharePipeline implements ShouldQueue $exists = Notification::whereProfileId($target->id) ->whereActorId($status->profile_id) ->whereAction('share') - ->whereItemId($status->in_reply_to_id) + ->whereItemId($status->reblog_of_id) ->whereItemType('App\Status') ->count(); - if ($actor->id === $status->profile_id || $exists !== 0) { + if ($target->id === $status->profile_id || $exists !== 0) { return true; } try { - $text = "{$actor->username} " . __('notification.likedPhoto'); - $html = ''; - $notification = new Notification(); - $notification->profile_id = $status->profile_id; + $notification = new Notification; + $notification->profile_id = $target->id; $notification->actor_id = $actor->id; $notification->action = 'share'; - $notification->message = $like->toText(); - $notification->rendered = $like->toHtml(); + $notification->message = $status->shareToText(); + $notification->rendered = $status->shareToHtml(); $notification->item_id = $status->id; $notification->item_type = "App\Status"; $notification->save();