]> git.mxchange.org Git - friendica.git/commitdiff
Issue 10706: Publish public custom fields in AP
authorMichael <heluecht@pirati.ca>
Tue, 14 Sep 2021 01:28:58 +0000 (01:28 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 14 Sep 2021 01:28:58 +0000 (01:28 +0000)
src/Protocol/ActivityPub.php
src/Protocol/ActivityPub/Transmitter.php

index 153ee54658fde831ce13aa96f9090971d4ff6dad..9a5f06004d8c11d16627b46a4fd4c4efc93ec516 100644 (file)
@@ -64,10 +64,14 @@ class ActivityPub
                'diaspora' => 'https://diasporafoundation.org/ns/',
                'litepub' => 'http://litepub.social/ns#',
                'toot' => 'http://joinmastodon.org/ns#',
+               'schema' => 'http://schema.org#',
                'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
                'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
                'directMessage' => 'litepub:directMessage',
-               'discoverable' => 'toot:discoverable']];
+               'discoverable' => 'toot:discoverable',
+               'PropertyValue' => 'schema:PropertyValue',
+               'value' => 'schema:value',
+]];
        const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone'];
        /**
         * Checks if the web request is done for the AP protocol
index bd43eea04893a796deb4b57afea4930f54598f8a..4dbcda4e7108e583b607d86f0df44323d9cbbeba 100644 (file)
@@ -392,6 +392,20 @@ class Transmitter
                        }
                }
 
+               $custom_fields = [];
+
+               foreach (DI::profileField()->selectByContactId(0, 1) as $profile_field) {
+                       $custom_fields[] = [
+                               'type' => 'PropertyValue',
+                               'name' => $profile_field->label,
+                               'value' => BBCode::convertForUriId($owner['uri-id'], $profile_field->value)
+                       ];
+               };
+
+               if (!empty($custom_fields)) {
+                       $data['attachment'] = $custom_fields;
+               }
+
                $data['generator'] = self::getService();
 
                // tags: https://kitty.town/@inmysocks/100656097926961126.json