Use the follower collection
This commit is contained in:
parent
b7744ae3eb
commit
71cbe56293
1 changed files with 16 additions and 6 deletions
|
@ -216,7 +216,7 @@ class ActivityPub
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function fetchTargetInboxesFromConversation($item)
|
private static function fetchTargetInboxesFromConversation($item, $uid)
|
||||||
{
|
{
|
||||||
if (empty($item['thr-parent'])) {
|
if (empty($item['thr-parent'])) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -244,10 +244,20 @@ class ActivityPub
|
||||||
$activity[$element] = [$activity[$element]];
|
$activity[$element] = [$activity[$element]];
|
||||||
}
|
}
|
||||||
foreach ($activity[$element] as $receiver) {
|
foreach ($activity[$element] as $receiver) {
|
||||||
$profile = self::fetchprofile($receiver);
|
if ($receiver == $profile['followers']) {
|
||||||
if (!empty($profile)) {
|
$contacts = DBA::select('contact', ['notify', 'batch'], ['uid' => $uid,
|
||||||
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::ACTIVITYPUB]);
|
||||||
$inboxes[$target] = $target;
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
|
$contact = defaults($contact, 'batch', $contact['notify']);
|
||||||
|
$inboxes[$contact] = $contact;
|
||||||
|
}
|
||||||
|
DBA::close($contacts);
|
||||||
|
} else {
|
||||||
|
$profile = self::fetchprofile($receiver);
|
||||||
|
if (!empty($profile)) {
|
||||||
|
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
||||||
|
$inboxes[$target] = $target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +266,7 @@ class ActivityPub
|
||||||
|
|
||||||
public static function fetchTargetInboxes($item, $uid)
|
public static function fetchTargetInboxes($item, $uid)
|
||||||
{
|
{
|
||||||
$inboxes = self::fetchTargetInboxesFromConversation($item);
|
$inboxes = self::fetchTargetInboxesFromConversation($item, $uid);
|
||||||
|
|
||||||
$parents = Item::select(['author-link', 'owner-link'], ['parent' => $item['parent']]);
|
$parents = Item::select(['author-link', 'owner-link'], ['parent' => $item['parent']]);
|
||||||
while ($parent = Item::fetch($parents)) {
|
while ($parent = Item::fetch($parents)) {
|
||||||
|
|
Loading…
Reference in a new issue