From e3413cf959de619979ccc61400657c6936318c7d Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 14 Sep 2021 01:28:58 +0000 Subject: [PATCH] Issue 10706: Publish public custom fields in AP --- src/Protocol/ActivityPub.php | 6 +++++- src/Protocol/ActivityPub/Transmitter.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub.php b/src/Protocol/ActivityPub.php index 153ee54658..9a5f06004d 100644 --- a/src/Protocol/ActivityPub.php +++ b/src/Protocol/ActivityPub.php @@ -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 diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index bd43eea048..4dbcda4e71 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -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