From 14d43c2a7e8c11bc7744235897c483e3fbcb4c07 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 6 Aug 2019 21:36:36 -0600 Subject: [PATCH] Update AP handler, deliver unlisted and followers-only posts --- .../StatusPipeline/StatusActivityPubDeliver.php | 2 +- app/Status.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php b/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php index ec4243107..ac0279de1 100644 --- a/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php +++ b/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php @@ -57,7 +57,7 @@ class StatusActivityPubDeliver implements ShouldQueue $audience = $status->profile->getAudienceInbox(); - if(empty($audience) || $status->scope != 'public') { + if(empty($audience) || !in_array($status->scope, ['public', 'unlisted', 'private']) { // Return on profiles with no remote followers return; } diff --git a/app/Status.php b/app/Status.php index 769f0c719..d0396ebf5 100644 --- a/app/Status.php +++ b/app/Status.php @@ -379,12 +379,25 @@ class Status extends Model break; case 'unlisted': + $res['to'] = [ + $this->profile->permalink('/followers') + ]; + $res['cc'] = [ + "https://www.w3.org/ns/activitystreams#Public" + ]; break; case 'private': + $res['to'] = [ + $this->profile->permalink('/followers') + ]; + $res['cc'] = []; break; + // TODO: Update scope when DMs are supported case 'direct': + $res['to'] = []; + $res['cc'] = []; break; } return $res[$audience];