]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/ClientToServer.php
"audience" is set for forum posts / followers posts are directed to the followers...
[friendica.git] / src / Protocol / ActivityPub / ClientToServer.php
index 7c0919f636911342ed0e86765fc165de7fd1c6e6..ee162382b839c6aa896c44cf15b4063cc036dd5c 100644 (file)
@@ -208,7 +208,7 @@ class ClientToServer
 
                $targets = [];
 
-               foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
+               foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc', 'as:audience'] as $element) {
                        switch ($element) {
                                case 'as:to':
                                        $type = Receiver::TARGET_TO;
@@ -222,6 +222,9 @@ class ClientToServer
                                case 'as:bcc':
                                        $type = Receiver::TARGET_BCC;
                                        break;
+                               case 'as:audience':
+                                       $type = Receiver::TARGET_AUDIENCE;
+                                       break;
                        }
                        $receiver_list = JsonLD::fetchElementArray($object, $element, '@id');
                        if (empty($receiver_list)) {
@@ -264,7 +267,7 @@ class ClientToServer
                $item['contact-id'] = $owner['id'];
                $item['author-id']  = $item['owner-id']  = Contact::getPublicIdByUserId($uid);
                $item['title']      = $object_data['name'];
-               $item['body']       = Markdown::toBBCode($object_data['content']);
+               $item['body']       = Markdown::toBBCode($object_data['content'] ?? '');
                $item['app']        = $application['name'] ?? 'API';
 
                if (!empty($object_data['target'][Receiver::TARGET_GLOBAL])) {
@@ -354,6 +357,10 @@ class ClientToServer
 
                $apcontact = APContact::getByURL($owner['url']);
 
+               if (empty($apcontact)) {
+                       throw new \Friendica\Network\HTTPException\NotFoundException();
+               }
+
                return self::getCollection($condition, DI::baseUrl() . '/outbox/' . $owner['nickname'], $page, $max_id, $uid, $apcontact['statuses_count']);
        }