Proper Attentions
This commit is contained in:
parent
42bfb78184
commit
69b252b244
@ -78,28 +78,9 @@ $act->context->attention = common_get_attentions($content, $actor_profile, $inRe
|
|||||||
|
|
||||||
$discovery = new Activitypub_explorer;
|
$discovery = new Activitypub_explorer;
|
||||||
if ($to_profiles == "https://www.w3.org/ns/activitystreams#Public") {
|
if ($to_profiles == "https://www.w3.org/ns/activitystreams#Public") {
|
||||||
$to_profiles = array();
|
$to_profiles = [];
|
||||||
}
|
|
||||||
// Generate To objects
|
|
||||||
if (is_array($data->object->to)) {
|
|
||||||
// Remove duplicates from To actors set
|
|
||||||
array_unique($data->object->to);
|
|
||||||
foreach ($data->object->to as $to_url) {
|
|
||||||
try {
|
|
||||||
$to_profiles = array_merge($to_profiles, $discovery->lookup($to_url));
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// Invalid actor found, just let it go.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif (empty($data->object->to) || in_array($data->object->to, $public_to)) {
|
|
||||||
// No need to do anything else at this point, let's just break out the if
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$to_profiles = array_merge($to_profiles, $discovery->lookup($data->object->to));
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// Invalid actor found, just let it go.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Cc objects
|
// Generate Cc objects
|
||||||
if (isset($data->object->cc) && is_array($data->object->cc)) {
|
if (isset($data->object->cc) && is_array($data->object->cc)) {
|
||||||
// Remove duplicates from Cc actors set
|
// Remove duplicates from Cc actors set
|
||||||
|
@ -62,9 +62,9 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$to = [];
|
$cc = [common_local_url('apActorFollowers', ['id' => $profile->getID()])];
|
||||||
foreach ($notice->getAttentionProfiles() as $to_profile) {
|
foreach ($notice->getAttentionProfiles() as $to_profile) {
|
||||||
$to[] = $href = $to_profile->getUri();
|
$cc[] = $href = $to_profile->getUri();
|
||||||
$tags[] = Activitypub_mention_tag::mention_tag_to_array_from_values($href, $to_profile->getNickname().'@'.parse_url($href, PHP_URL_HOST));
|
$tags[] = Activitypub_mention_tag::mention_tag_to_array_from_values($href, $to_profile->getNickname().'@'.parse_url($href, PHP_URL_HOST));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +78,8 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
|
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
|
||||||
'url' => $notice->getUrl(),
|
'url' => $notice->getUrl(),
|
||||||
'atributtedTo' => ActivityPubPlugin::actor_uri($profile),
|
'atributtedTo' => ActivityPubPlugin::actor_uri($profile),
|
||||||
'to' => $to,
|
'to' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
'cc' => common_local_url('apActorFollowers', ['id' => $profile->getID()]),
|
'cc' => $cc,
|
||||||
'atomUri' => $notice->getUrl(),
|
'atomUri' => $notice->getUrl(),
|
||||||
'conversation' => $notice->getConversationUrl(),
|
'conversation' => $notice->getConversationUrl(),
|
||||||
'content' => $notice->getRendered(),
|
'content' => $notice->getRendered(),
|
||||||
|
Reference in New Issue
Block a user