]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/ClientToServer.php
Merge remote-tracking branch 'upstream/develop' into restricted-access
[friendica.git] / src / Protocol / ActivityPub / ClientToServer.php
index 7c0919f636911342ed0e86765fc165de7fd1c6e6..2b52d17b767dc22ef39bf7519182aabfd1ff9f32 100644 (file)
@@ -28,7 +28,7 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\APContact;
 use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
 use Friendica\Model\Item;
 use Friendica\Model\Post;
 use Friendica\Model\User;
@@ -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])) {
@@ -281,7 +284,7 @@ class ClientToServer
                        $item['private']   = Item::UNLISTED;
                } elseif (!empty($object_data['target'][Receiver::TARGET_FOLLOWER])) {
                        $item['allow_cid'] = '';
-                       $item['allow_gid'] = '<' . Group::FOLLOWERS . '>';
+                       $item['allow_gid'] = '<' . Circle::FOLLOWERS . '>';
                        $item['deny_cid']  = '';
                        $item['deny_gid']  = '';
                        $item['private']   = Item::PRIVATE;
@@ -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']);
        }