浏览代码

Update AP handler, deliver unlisted and followers-only posts

Daniel Supernault 6 年之前
父节点
当前提交
14d43c2a7e
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 1 1
      app/Jobs/StatusPipeline/StatusActivityPubDeliver.php
  2. 13 0
      app/Status.php

+ 1 - 1
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;
         }

+ 13 - 0
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];