fix some AP addressing quirks

This commit is contained in:
Mike Macgirvin 2024-06-04 15:44:09 +10:00
parent 61fcdea04b
commit aea980fc3d
2 changed files with 12 additions and 1 deletions

View file

@ -1942,7 +1942,7 @@ function addToCollectionAndSync($ret)
return $ret;
}
$channel = Channel::from_id($ret['item']['uid']);
if ($channel && $channel['channel_hash'] === $ret['item']['owner_xchan']) {
if ($channel && $channel['channel_hash'] === $ret['item']['owner_xchan'] && !((int)$ret['item']['item_restrict'] & 1)) {
$items = [$ret['item']];
if ((int)$items[0]['item_blocked'] === ITEM_MODERATED
|| (int)$items[0]['item_unpublished'] || (int)$items[0]['item_delayed']) {

View file

@ -1031,6 +1031,7 @@ class Activity
// addressing madness
if ($activitypub) {
$postopts = explode(',', $item['postopts']);
$parent_i = [];
$public = !$item['item_private'];
$top_level = ($item['mid'] === $item['parent_mid']);
@ -1081,6 +1082,11 @@ class Activity
$activity['cc'][] = $addr;
}
}
}
$myfollowers = z_root() . '/followers/' . substr($item['author']['xchan_addr'], 0, strpos($item['author']['xchan_addr'], '@'));
if (in_array('followers', $postopts) && !in_array($myfollowers, $activity['cc'])) {
$activity['cc'][] = $myfollowers;
}
$mentions = self::map_mentions($item);
@ -1390,6 +1396,7 @@ class Activity
// addressing madness
if ($activitypub) {
$postopts = explode(',', $item['postopts']);
$parent_i = [];
$activity['to'] = [];
$activity['cc'] = [];
@ -1459,6 +1466,10 @@ class Activity
}
}
}
$myfollowers = z_root() . '/followers/' . substr($item['author']['xchan_addr'], 0, strpos($item['author']['xchan_addr'], '@'));
if (in_array('followers', $postopts) && !in_array($myfollowers, $activity['cc'])) {
$activity['cc'][] = $myfollowers;
}
$mentions = self::map_mentions($item);
if (count($mentions) > 0) {