mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 04:53:17 +00:00
Update notification pipelines, fix non-local saving
This commit is contained in:
parent
4d4013896c
commit
fa97a1f38e
4 changed files with 50 additions and 42 deletions
|
@ -91,19 +91,21 @@ class CommentPipeline implements ShouldQueue
|
|||
return;
|
||||
}
|
||||
|
||||
DB::transaction(function() use($target, $actor, $comment) {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'comment';
|
||||
$notification->item_id = $comment->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
if($target->user_id && $target->domain === null) {
|
||||
DB::transaction(function() use($target, $actor, $comment) {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'comment';
|
||||
$notification->item_id = $comment->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
|
||||
NotificationService::setNotification($notification);
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
StatusService::del($comment->id);
|
||||
});
|
||||
NotificationService::setNotification($notification);
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
StatusService::del($comment->id);
|
||||
});
|
||||
}
|
||||
|
||||
if($exists = Cache::get('status:replies:all:' . $status->id)) {
|
||||
if($exists && $exists->count() == 3) {
|
||||
|
|
|
@ -72,16 +72,18 @@ class FollowPipeline implements ShouldQueue
|
|||
$target->save();
|
||||
AccountService::del($target->id);
|
||||
|
||||
try {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'follow';
|
||||
$notification->item_id = $target->id;
|
||||
$notification->item_type = "App\Profile";
|
||||
$notification->save();
|
||||
} catch (Exception $e) {
|
||||
Log::error($e);
|
||||
if($target->user_id && $target->domain === null) {
|
||||
try {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'follow';
|
||||
$notification->item_id = $target->id;
|
||||
$notification->item_type = "App\Profile";
|
||||
$notification->save();
|
||||
} catch (Exception $e) {
|
||||
Log::error($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,16 +79,18 @@ class LikePipeline implements ShouldQueue
|
|||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $status->profile_id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'like';
|
||||
$notification->item_id = $status->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
if($status->uri === null && $status->object_url === null && $status->url === null) {
|
||||
try {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $status->profile_id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'like';
|
||||
$notification->item_id = $status->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,18 +87,20 @@ class StatusReplyPipeline implements ShouldQueue
|
|||
Cache::forget('status:replies:all:' . $reply->id);
|
||||
Cache::forget('status:replies:all:' . $status->id);
|
||||
|
||||
DB::transaction(function() use($target, $actor, $status) {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'comment';
|
||||
$notification->item_id = $status->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
if($target->user_id && $target->domain === null) {
|
||||
DB::transaction(function() use($target, $actor, $status) {
|
||||
$notification = new Notification();
|
||||
$notification->profile_id = $target->id;
|
||||
$notification->actor_id = $actor->id;
|
||||
$notification->action = 'comment';
|
||||
$notification->item_id = $status->id;
|
||||
$notification->item_type = "App\Status";
|
||||
$notification->save();
|
||||
|
||||
NotificationService::setNotification($notification);
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
});
|
||||
NotificationService::setNotification($notification);
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
});
|
||||
}
|
||||
|
||||
if($exists = Cache::get('status:replies:all:' . $reply->id)) {
|
||||
if($exists && $exists->count() == 3) {
|
||||
|
|
Loading…
Reference in a new issue