forked from mirror/pixelfed
Update SharePipeline
This commit is contained in:
parent
9765ec3d68
commit
63d7e4ecaa
1 changed files with 10 additions and 12 deletions
|
@ -17,7 +17,7 @@ class SharePipeline implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
protected $like;
|
protected $status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the job if its models no longer exist.
|
* Delete the job if its models no longer exist.
|
||||||
|
@ -44,10 +44,10 @@ class SharePipeline implements ShouldQueue
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$status = $this->status;
|
$status = $this->status;
|
||||||
$actor = $this->status->profile;
|
$actor = $status->profile;
|
||||||
$target = $this->status->parent()->profile;
|
$target = $status->parent()->profile;
|
||||||
|
|
||||||
if ($status->url !== null) {
|
if ($status->uri !== null) {
|
||||||
// Ignore notifications to remote statuses
|
// Ignore notifications to remote statuses
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,23 +55,21 @@ class SharePipeline implements ShouldQueue
|
||||||
$exists = Notification::whereProfileId($target->id)
|
$exists = Notification::whereProfileId($target->id)
|
||||||
->whereActorId($status->profile_id)
|
->whereActorId($status->profile_id)
|
||||||
->whereAction('share')
|
->whereAction('share')
|
||||||
->whereItemId($status->in_reply_to_id)
|
->whereItemId($status->reblog_of_id)
|
||||||
->whereItemType('App\Status')
|
->whereItemType('App\Status')
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
if ($actor->id === $status->profile_id || $exists !== 0) {
|
if ($target->id === $status->profile_id || $exists !== 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$text = "{$actor->username} " . __('notification.likedPhoto');
|
$notification = new Notification;
|
||||||
$html = '';
|
$notification->profile_id = $target->id;
|
||||||
$notification = new Notification();
|
|
||||||
$notification->profile_id = $status->profile_id;
|
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'share';
|
$notification->action = 'share';
|
||||||
$notification->message = $like->toText();
|
$notification->message = $status->shareToText();
|
||||||
$notification->rendered = $like->toHtml();
|
$notification->rendered = $status->shareToHtml();
|
||||||
$notification->item_id = $status->id;
|
$notification->item_id = $status->id;
|
||||||
$notification->item_type = "App\Status";
|
$notification->item_type = "App\Status";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
Loading…
Reference in a new issue