From 4d0fde2efa057d88bebb76e832fdef85962da1ad Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 24 Dec 2018 23:35:04 -0700 Subject: [PATCH 1/2] Update inbox --- app/Util/ActivityPub/Inbox.php | 38 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index 0a3fcd8c5..48a7e443f 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -205,15 +205,15 @@ class Inbox return; } // send notification - $notification = new Notification(); - $notification->profile_id = $target->id; - $notification->actor_id = $actor->id; - $notification->action = 'follow'; - $notification->message = $follower->toText(); - $notification->rendered = $follower->toHtml(); - $notification->item_id = $target->id; - $notification->item_type = "App\Profile"; - $notification->save(); + Notification::firstOrCreate([ + 'profile_id' => $target->id, + 'actor_id' => $actor->id, + 'action' => 'follow', + 'message' => $follower->toText(), + 'rendered' => $follower->toHtml(), + 'item_id' => $target->id, + 'item_type' => 'App\Profile' + ]); // send Accept to remote profile $accept = [ @@ -251,17 +251,15 @@ class Inbox 'in_reply_to_id' => $parent->id, 'type' => 'reply' ]); - if($status->wasRecentlyCreated) { - $notification = new Notification(); - $notification->profile_id = $parent->profile->id; - $notification->actor_id = $actor->id; - $notification->action = 'comment'; - $notification->message = $status->toText(); - $notification->rendered = $status->toHtml(); - $notification->item_id = $parent->id; - $notification->item_type = "App\Status"; - $notification->save(); - } + Notification::firstOrCreate([ + 'profile_id' => $parent->profile->id, + 'actor_id' => $actor->id, + 'action' => 'share', + 'message' => $status->replyToText(), + 'rendered' => $status->replyToHtml(), + 'item_id' => $parent->id, + 'item_type' => 'App\Status' + ]); } public function handleAcceptActivity() From a6d48dc19f249673e5e3ade8d125c20fb96ae217 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 24 Dec 2018 23:35:23 -0700 Subject: [PATCH 2/2] Bump version to 0.7.2 --- config/pixelfed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/pixelfed.php b/config/pixelfed.php index 3fa1c3690..b0118cd0e 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -23,7 +23,7 @@ return [ | This value is the version of your PixelFed instance. | */ - 'version' => '0.7.1', + 'version' => '0.7.2', /* |--------------------------------------------------------------------------