attributions continued

This commit is contained in:
Mike Macgirvin 2024-07-04 15:51:20 +10:00
parent 1df893af9c
commit c9f0a367c0

View file

@ -1214,7 +1214,8 @@ class Activity
} }
} }
$activity['attributedTo'] = Channel::getDidResolver($item['author'], true);
$activity['attributedTo'] = self::actorEncode($item['author'],false);
if ($item['mid'] === $item['parent_mid']) { if ($item['mid'] === $item['parent_mid']) {
if (in_array($item['comment_policy'], ['self', 'none']) || $item['item_nocomment'] || ($item['comments_closed'] > NULL_DATE && Time::convert('UTC', 'UTC', $item['comments_closed']) <= Time::convert())) { if (in_array($item['comment_policy'], ['self', 'none']) || $item['item_nocomment'] || ($item['comments_closed'] > NULL_DATE && Time::convert('UTC', 'UTC', $item['comments_closed']) <= Time::convert())) {
@ -5183,6 +5184,7 @@ class Activity
if (!isset($channel['xchan_hash'])) { if (!isset($channel['xchan_hash'])) {
$channel = Channel::from_hash($channel['channel_hash']); $channel = Channel::from_hash($channel['channel_hash']);
} }
$isNomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
$item = ((new Item()) $item = ((new Item())
->setUid($channel['channel_id']) ->setUid($channel['channel_id'])
->setVerb('Add') ->setVerb('Add')
@ -5198,7 +5200,7 @@ class Activity
->setTarget([ ->setTarget([
'id' => str_replace('/item/','/conversation/', $target), 'id' => str_replace('/item/','/conversation/', $target),
'type' => 'Collection', 'type' => 'Collection',
'attributedTo' => Channel::getDidResolver($channel, true) 'attributedTo' => (($isNomadic) ? Channel::getDidResolver($channel, true) : z_root() . '/channel/' . $channel['channel_address']),
] ]
) )
); );
@ -5221,6 +5223,7 @@ class Activity
if (!isset($channel['xchan_hash'])) { if (!isset($channel['xchan_hash'])) {
$channel = Channel::from_hash($channel['channel_hash']); $channel = Channel::from_hash($channel['channel_hash']);
} }
$isNomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
$item = ((new Item()) $item = ((new Item())
->setUid($channel['channel_id']) ->setUid($channel['channel_id'])
->setVerb('Remove') ->setVerb('Remove')
@ -5235,7 +5238,7 @@ class Activity
->setTarget([ ->setTarget([
'id' => str_replace('/item/','/conversation/', $target), 'id' => str_replace('/item/','/conversation/', $target),
'type' => 'Collection', 'type' => 'Collection',
'attributedTo' => Channel::getDidResolver($channel, true) 'attributedTo' => (($isNomadic) ? Channel::getDidResolver($channel, true) : z_root() . '/channel/' . $channel['channel_address']),
] ]
) )
); );