Fetch the receiver from the parent posting as well

This commit is contained in:
Michael 2018-09-21 04:51:54 +00:00
parent 355346298b
commit 5310d54c13

View file

@ -829,6 +829,15 @@ class ActivityPub
{ {
$receivers = []; $receivers = [];
// When it is an answer, we inherite the receivers from the parent
$replyto = JsonLD::fetchElement($activity, 'inReplyTo', 'id');
if (!empty($replyto)) {
$parents = Item::select(['uid'], ['uri' => $replyto]);
while ($parent = Item::fetch($parents)) {
$receivers['uid:' . $parent['uid']] = $parent['uid'];
}
}
if (!empty($actor)) { if (!empty($actor)) {
$profile = self::fetchprofile($actor); $profile = self::fetchprofile($actor);
$followers = defaults($profile, 'followers', ''); $followers = defaults($profile, 'followers', '');
@ -1211,6 +1220,7 @@ class ActivityPub
$activity['object'] = $object; $activity['object'] = $object;
$activity['published'] = $object['published']; $activity['published'] = $object['published'];
$activity['type'] = 'Create'; $activity['type'] = 'Create';
self::processActivity($activity); self::processActivity($activity);
logger('Activity ' . $url . ' had been fetched and processed.'); logger('Activity ' . $url . ' had been fetched and processed.');
} }