mirror of
https://github.com/friendica/friendica
synced 2025-04-27 08:30:10 +00:00
Support unlisted public posts
This commit is contained in:
parent
357c0072bd
commit
ca1b92bb34
29 changed files with 146 additions and 100 deletions
|
@ -506,14 +506,15 @@ class Receiver
|
|||
/**
|
||||
* Fetch the receiver list from an activity array
|
||||
*
|
||||
* @param array $activity
|
||||
* @param string $actor
|
||||
* @param array $tags
|
||||
* @param array $activity
|
||||
* @param string $actor
|
||||
* @param array $tags
|
||||
* @param boolean $fetch_unlisted
|
||||
*
|
||||
* @return array with receivers (user id)
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function getReceivers($activity, $actor, $tags = [])
|
||||
private static function getReceivers($activity, $actor, $tags = [], $fetch_unlisted = false)
|
||||
{
|
||||
$receivers = [];
|
||||
|
||||
|
@ -551,6 +552,11 @@ class Receiver
|
|||
$receivers['uid:0'] = 0;
|
||||
}
|
||||
|
||||
// Add receiver "-1" for unlisted posts
|
||||
if ($fetch_unlisted && ($receiver == self::PUBLIC_COLLECTION) && ($element == 'as:cc')) {
|
||||
$receivers['uid:-1'] = -1;
|
||||
}
|
||||
|
||||
if (($receiver == self::PUBLIC_COLLECTION) && !empty($actor)) {
|
||||
// This will most likely catch all OStatus connections to Mastodon
|
||||
$condition = ['alias' => [$actor, Strings::normaliseLink($actor)], 'rel' => [Contact::SHARING, Contact::FRIEND]
|
||||
|
@ -1022,7 +1028,9 @@ class Receiver
|
|||
}
|
||||
}
|
||||
|
||||
$object_data['receiver'] = self::getReceivers($object, $object_data['actor'], $object_data['tags']);
|
||||
$object_data['receiver'] = self::getReceivers($object, $object_data['actor'], $object_data['tags'], true);
|
||||
$object_data['unlisted'] = in_array(-1, $object_data['receiver']);
|
||||
unset($object_data['receiver']['uid:-1']);
|
||||
|
||||
// Common object data:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue