mirror of
https://github.com/friendica/friendica
synced 2025-04-26 19:10:11 +00:00
Store Pixelfed's capabilities
This commit is contained in:
parent
a86cd93fb8
commit
da65f0bea7
4 changed files with 46 additions and 0 deletions
|
@ -1943,6 +1943,10 @@ class Receiver
|
|||
$object_data['receiver'] = $receivers;
|
||||
$object_data['reception_type'] = $reception_types;
|
||||
|
||||
if (!empty($object['pixelfed:capabilities'])) {
|
||||
$object_data['capabilities'] = self::getCapabilities($object);
|
||||
}
|
||||
|
||||
$object_data['unlisted'] = in_array(-1, $object_data['receiver']);
|
||||
unset($object_data['receiver'][-1]);
|
||||
unset($object_data['reception_type'][-1]);
|
||||
|
@ -1950,6 +1954,18 @@ class Receiver
|
|||
return $object_data;
|
||||
}
|
||||
|
||||
private static function getCapabilities($object) {
|
||||
$capabilities = [];
|
||||
foreach (['pixelfed:canAnnounce', 'pixelfed:canLike', 'pixelfed:canReply'] as $element) {
|
||||
$capabilities_list = JsonLD::fetchElementArray($object['pixelfed:capabilities'], $element, '@id');
|
||||
if (empty($capabilities_list)) {
|
||||
continue;
|
||||
}
|
||||
$capabilities[$element] = $capabilities_list;
|
||||
}
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an object data array from a given activity
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue