mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:50:11 +00:00
Changes variable names / fetch the alias / improved group handling
This commit is contained in:
parent
8a50101eea
commit
968c935bf7
3 changed files with 55 additions and 31 deletions
|
@ -432,21 +432,38 @@ class Processor
|
|||
|
||||
$item['owner-link'] = $item['author-link'];
|
||||
$item['owner-id'] = $item['author-id'];
|
||||
} else {
|
||||
$actor = APContact::getByURL($item['owner-link'], false);
|
||||
$item['isGroup'] = ($actor['type'] ?? 'Person') == 'Group';
|
||||
}
|
||||
|
||||
if (!$item['isGroup'] && !empty($activity['receiver_urls']['as:audience'])) {
|
||||
foreach ($activity['receiver_urls']['as:audience'] as $audience) {
|
||||
$actor = APContact::getByURL($audience, false);
|
||||
if (($actor['type'] ?? 'Person') == 'Group') {
|
||||
Logger::debug('Set owner to audience', ['audience' => $audience, 'actor' => $activity['actor'], 'author' => $activity['author']]);
|
||||
Logger::debug('Group post detected via audience.', ['audience' => $audience, 'actor' => $activity['actor'], 'author' => $activity['author']]);
|
||||
$item['isGroup'] = true;
|
||||
$item['owner-link'] = $audience;
|
||||
$item['owner-id'] = Contact::getIdForURL($audience);
|
||||
$item['group-link'] = $audience;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$owner = APContact::getByURL($item['owner-link'], false);
|
||||
}
|
||||
|
||||
if (!$item['isGroup'] && (($owner['type'] ?? 'Person') == 'Group')) {
|
||||
Logger::debug('Group post detected via owner.', ['actor' => $activity['actor'], 'author' => $activity['author']]);
|
||||
$item['isGroup'] = true;
|
||||
$item['group-link'] = $item['owner-link'];
|
||||
} elseif (!empty($item['causer-link'])) {
|
||||
$causer = APContact::getByURL($item['causer-link'], false);
|
||||
}
|
||||
|
||||
if (!$item['isGroup'] && (($causer['type'] ?? 'Person') == 'Group')) {
|
||||
Logger::debug('Group post detected via causer.', ['actor' => $activity['actor'], 'author' => $activity['author'], 'causer' => $item['causer-link']]);
|
||||
$item['isGroup'] = true;
|
||||
$item['group-link'] = $item['causer-link'];
|
||||
}
|
||||
|
||||
if (!empty($item['group-link']) && empty($item['causer-link'])) {
|
||||
$item['causer-link'] = $item['group-link'];
|
||||
$item['causer-id'] = Contact::getIdForURL($item['causer-link']);
|
||||
}
|
||||
|
||||
$item['uri'] = $activity['id'];
|
||||
|
@ -1071,8 +1088,8 @@ class Processor
|
|||
$item['causer-id'] = ($item['gravity'] == Item::GRAVITY_PARENT) ? $item['owner-id'] : $item['author-id'];
|
||||
}
|
||||
|
||||
if ($item['isGroup'] ?? false) {
|
||||
$item['contact-id'] = Contact::getIdForURL($item['owner-link'], $receiver);
|
||||
if ($item['isGroup']) {
|
||||
$item['contact-id'] = Contact::getIdForURL($item['group-link'], $receiver);
|
||||
} else {
|
||||
$item['contact-id'] = Contact::getIdForURL($item['author-link'], $receiver);
|
||||
}
|
||||
|
@ -1087,7 +1104,7 @@ class Processor
|
|||
}
|
||||
|
||||
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['isGroup'] ?? false)) {
|
||||
if (!$item['isGroup']) {
|
||||
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']]);
|
||||
continue;
|
||||
|
@ -1108,7 +1125,7 @@ class Processor
|
|||
}
|
||||
|
||||
if ((DI::pConfig()->get($receiver, 'system', 'accept_only_sharer') == Item::COMPLETION_NONE)
|
||||
&& ((!$isGroup && !($item['isGroup'] ?? false) && ($activity['type'] != 'as:Announce'))
|
||||
&& ((!$isGroup && !$item['isGroup'] && ($activity['type'] != 'as:Announce'))
|
||||
|| !Contact::isSharingByURL($activity['actor'], $receiver))) {
|
||||
Logger::info('Actor is a non sharer, is no group or it is no announce', ['uid' => $receiver, 'actor' => $activity['actor'], 'url' => $item['uri'], 'type' => $activity['type']]);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue