mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Store "audience" and "attributedTo" data
This commit is contained in:
parent
a36e53af3c
commit
78b969cb19
8 changed files with 90 additions and 57 deletions
|
@ -208,7 +208,7 @@ class ClientToServer
|
|||
|
||||
$targets = [];
|
||||
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc', 'as:audience'] as $element) {
|
||||
switch ($element) {
|
||||
case 'as:to':
|
||||
$type = Receiver::TARGET_TO;
|
||||
|
@ -222,7 +222,10 @@ class ClientToServer
|
|||
case 'as:bcc':
|
||||
$type = Receiver::TARGET_BCC;
|
||||
break;
|
||||
}
|
||||
case 'as:audience':
|
||||
$type = Receiver::TARGET_AUDIENCE;
|
||||
break;
|
||||
}
|
||||
$receiver_list = JsonLD::fetchElementArray($object, $element, '@id');
|
||||
if (empty($receiver_list)) {
|
||||
continue;
|
||||
|
|
|
@ -1026,6 +1026,9 @@ class Processor
|
|||
case Receiver::TARGET_BCC:
|
||||
$item['post-reason'] = Item::PR_BCC;
|
||||
break;
|
||||
case Receiver::TARGET_AUDIENCE:
|
||||
$item['post-reason'] = Item::PR_AUDIENCE;
|
||||
break;
|
||||
case Receiver::TARGET_FOLLOWER:
|
||||
$item['post-reason'] = Item::PR_FOLLOWER;
|
||||
break;
|
||||
|
@ -1071,7 +1074,7 @@ class Processor
|
|||
continue;
|
||||
}
|
||||
|
||||
if (($receiver != 0) && ($item['gravity'] == Item::GRAVITY_PARENT) && !in_array($item['post-reason'], [Item::PR_FOLLOWER, Item::PR_TAG, item::PR_TO, Item::PR_CC])) {
|
||||
if (($receiver != 0) && ($item['gravity'] == Item::GRAVITY_PARENT) && !in_array($item['post-reason'], [Item::PR_FOLLOWER, Item::PR_TAG, item::PR_TO, Item::PR_CC, Item::PR_AUDIENCE])) {
|
||||
if (!($item['isForum'] ?? false)) {
|
||||
if ($item['post-reason'] == Item::PR_BCC) {
|
||||
Logger::info('Top level post via BCC from a non sharer, ignoring', ['uid' => $receiver, 'contact' => $item['contact-id'], 'url' => $item['uri']]);
|
||||
|
@ -1274,7 +1277,7 @@ class Processor
|
|||
|
||||
public static function storeReceivers(int $uriid, array $receivers)
|
||||
{
|
||||
foreach (['as:to' => Tag::TO, 'as:cc' => Tag::CC, 'as:bto' => Tag::BTO, 'as:bcc' => Tag::BCC] as $element => $type) {
|
||||
foreach (['as:to' => Tag::TO, 'as:cc' => Tag::CC, 'as:bto' => Tag::BTO, 'as:bcc' => Tag::BCC, 'as:audience' => Tag::AUDIENCE, 'as:attributedTo' => Tag::ATTRIBUTED] as $element => $type) {
|
||||
if (!empty($receivers[$element])) {
|
||||
foreach ($receivers[$element] as $receiver) {
|
||||
if ($receiver == ActivityPub::PUBLIC_COLLECTION) {
|
||||
|
|
|
@ -73,6 +73,7 @@ class Receiver
|
|||
const TARGET_FOLLOWER = 5;
|
||||
const TARGET_ANSWER = 6;
|
||||
const TARGET_GLOBAL = 7;
|
||||
const TARGET_AUDIENCE = 8;
|
||||
|
||||
const COMPLETION_NONE = 0;
|
||||
const COMPLETION_ANNOUNCE = 1;
|
||||
|
@ -487,7 +488,7 @@ class Receiver
|
|||
$object_data['object_type'] = $object_type;
|
||||
}
|
||||
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc', 'as:audience', 'as:attributedTo'] as $element) {
|
||||
if ((empty($object_data['receiver_urls'][$element]) || in_array($element, ['as:bto', 'as:bcc'])) && !empty($urls[$element])) {
|
||||
$object_data['receiver_urls'][$element] = array_unique(array_merge($object_data['receiver_urls'][$element] ?? [], $urls[$element]));
|
||||
}
|
||||
|
@ -1032,7 +1033,7 @@ class Receiver
|
|||
{
|
||||
$urls = [];
|
||||
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc', 'as:audience', 'as:attributedTo'] as $element) {
|
||||
$receiver_list = JsonLD::fetchElementArray($activity, $element, '@id');
|
||||
if (empty($receiver_list)) {
|
||||
continue;
|
||||
|
@ -1104,7 +1105,7 @@ class Receiver
|
|||
// We have to prevent false follower assumptions upon thread completions
|
||||
$follower_target = empty($activity['thread-completion']) ? self::TARGET_FOLLOWER : self::TARGET_UNKNOWN;
|
||||
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
|
||||
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc','as:audience'] as $element) {
|
||||
$receiver_list = JsonLD::fetchElementArray($activity, $element, '@id');
|
||||
if (empty($receiver_list)) {
|
||||
continue;
|
||||
|
@ -1165,7 +1166,10 @@ class Receiver
|
|||
case 'as:bcc':
|
||||
$type = self::TARGET_BCC;
|
||||
break;
|
||||
}
|
||||
case 'as:audience':
|
||||
$type = self::TARGET_AUDIENCE;
|
||||
break;
|
||||
}
|
||||
|
||||
$receivers[$contact['uid']] = ['uid' => $contact['uid'], 'type' => $type];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue