From d848792ad417165913c12d9f1e0931f044ecf986 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 01:38:17 -0700 Subject: [PATCH 1/2] Update DirectMessageController, deliver direct delete activities to user inbox instead of sharedInbox --- app/Http/Controllers/DirectMessageController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DirectMessageController.php b/app/Http/Controllers/DirectMessageController.php index 1f7e04e59..31f30f853 100644 --- a/app/Http/Controllers/DirectMessageController.php +++ b/app/Http/Controllers/DirectMessageController.php @@ -835,7 +835,7 @@ class DirectMessageController extends Controller public function remoteDelete($dm) { $profile = $dm->author; - $url = $dm->recipient->sharedInbox ?? $dm->recipient->inbox_url; + $url = $dm->recipient->inbox_url; $body = [ '@context' => [ From 7f462a80556ae1bffcec37d5172046aa0bf5386f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 02:07:26 -0700 Subject: [PATCH 2/2] Update DirectMessageController, dispatch deliver and delete actions to the job queue --- .../Controllers/DirectMessageController.php | 7 ++-- .../DirectPipeline/DirectDeletePipeline.php | 42 +++++++++++++++++++ .../DirectPipeline/DirectDeliverPipeline.php | 42 +++++++++++++++++++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 app/Jobs/DirectPipeline/DirectDeletePipeline.php create mode 100644 app/Jobs/DirectPipeline/DirectDeliverPipeline.php diff --git a/app/Http/Controllers/DirectMessageController.php b/app/Http/Controllers/DirectMessageController.php index 31f30f853..972422086 100644 --- a/app/Http/Controllers/DirectMessageController.php +++ b/app/Http/Controllers/DirectMessageController.php @@ -23,6 +23,8 @@ use App\Services\AccountService; use App\Services\StatusService; use App\Services\WebfingerService; use App\Models\Conversation; +use App\Jobs\DirectPipeline\DirectDeletePipeline; +use App\Jobs\DirectPipeline\DirectDeliverPipeline; class DirectMessageController extends Controller { @@ -829,7 +831,7 @@ class DirectMessageController extends Controller ] ]; - Helpers::sendSignedObject($profile, $url, $body); + DirectDeliverPipeline::dispatch($profile, $url, $body)->onQueue('high'); } public function remoteDelete($dm) @@ -852,7 +854,6 @@ class DirectMessageController extends Controller 'type' => 'Tombstone' ] ]; - - Helpers::sendSignedObject($profile, $url, $body); + DirectDeletePipeline::dispatch($profile, $url, $body)->onQueue('high'); } } diff --git a/app/Jobs/DirectPipeline/DirectDeletePipeline.php b/app/Jobs/DirectPipeline/DirectDeletePipeline.php new file mode 100644 index 000000000..947806422 --- /dev/null +++ b/app/Jobs/DirectPipeline/DirectDeletePipeline.php @@ -0,0 +1,42 @@ +profile = $profile; + $this->url = $url; + $this->payload = $payload; + } + + /** + * Execute the job. + */ + public function handle(): void + { + Helpers::sendSignedObject($this->profile, $this->url, $this->payload); + } +} diff --git a/app/Jobs/DirectPipeline/DirectDeliverPipeline.php b/app/Jobs/DirectPipeline/DirectDeliverPipeline.php new file mode 100644 index 000000000..7d20a406e --- /dev/null +++ b/app/Jobs/DirectPipeline/DirectDeliverPipeline.php @@ -0,0 +1,42 @@ +profile = $profile; + $this->url = $url; + $this->payload = $payload; + } + + /** + * Execute the job. + */ + public function handle(): void + { + Helpers::sendSignedObject($this->profile, $this->url, $this->payload); + } +}