Merge pull request #10707 from annando/issue-10706

Issue 10706: Publish public custom fields in AP
This commit is contained in:
Tobias Diekershoff 2021-09-14 06:54:48 +02:00 committed by GitHub
commit c3172cf3cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -64,10 +64,14 @@ class ActivityPub
'diaspora' => 'https://diasporafoundation.org/ns/', 'diaspora' => 'https://diasporafoundation.org/ns/',
'litepub' => 'http://litepub.social/ns#', 'litepub' => 'http://litepub.social/ns#',
'toot' => 'http://joinmastodon.org/ns#', 'toot' => 'http://joinmastodon.org/ns#',
'schema' => 'http://schema.org#',
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag', 'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
'directMessage' => 'litepub:directMessage', 'directMessage' => 'litepub:directMessage',
'discoverable' => 'toot:discoverable']]; 'discoverable' => 'toot:discoverable',
'PropertyValue' => 'schema:PropertyValue',
'value' => 'schema:value',
]];
const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone']; const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone'];
/** /**
* Checks if the web request is done for the AP protocol * Checks if the web request is done for the AP protocol

View file

@ -392,6 +392,20 @@ class Transmitter
} }
} }
$custom_fields = [];
foreach (DI::profileField()->selectByContactId(0, $uid) 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(); $data['generator'] = self::getService();
// tags: https://kitty.town/@inmysocks/100656097926961126.json // tags: https://kitty.town/@inmysocks/100656097926961126.json