Deliver everything to all receivers in the thread
This commit is contained in:
parent
59cd6611ec
commit
4c224fbddd
|
@ -46,13 +46,13 @@ use Friendica\Util\LDSignature;
|
||||||
* - Object Types: Person, Tombstome
|
* - Object Types: Person, Tombstome
|
||||||
*
|
*
|
||||||
* Transmitter:
|
* Transmitter:
|
||||||
* - Activities: Like, Dislike, Update, Delete
|
* - Activities: Like, Dislike, Update, Delete, Announce
|
||||||
* - Object Tyoes: Article, Announce, Person, Tombstone
|
* - Object Tyoes: Article, Person, Tombstone
|
||||||
*
|
*
|
||||||
* General:
|
* General:
|
||||||
* - Message distribution
|
* - Endpoints: Outbox, Follower, Following
|
||||||
* - Endpoints: Outbox, Object, Follower, Following
|
|
||||||
* - General cleanup
|
* - General cleanup
|
||||||
|
* - Queueing unsucessful deliveries
|
||||||
*/
|
*/
|
||||||
class ActivityPub
|
class ActivityPub
|
||||||
{
|
{
|
||||||
|
@ -172,13 +172,28 @@ class ActivityPub
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fetchTargetInboxes($item)
|
public static function fetchTargetInboxes($item, $uid)
|
||||||
{
|
{
|
||||||
$inboxes = [];
|
$inboxes = [];
|
||||||
|
|
||||||
|
$parents = Item::select(['author-link', 'owner-link'], ['parent' => $item['parent']]);
|
||||||
|
while ($parent = Item::fetch($parents)) {
|
||||||
|
$profile = self::fetchprofile($parent['author-link']);
|
||||||
|
if (!empty($profile)) {
|
||||||
|
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
||||||
|
$inboxes[$target] = $target;
|
||||||
|
}
|
||||||
|
$profile = self::fetchprofile($parent['owner-link']);
|
||||||
|
if (!empty($profile)) {
|
||||||
|
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
||||||
|
$inboxes[$target] = $target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DBA::close($parents);
|
||||||
|
|
||||||
$terms = Term::tagArrayFromItemId($item['id']);
|
$terms = Term::tagArrayFromItemId($item['id']);
|
||||||
if (!$item['private']) {
|
if (!$item['private']) {
|
||||||
$contacts = DBA::select('contact', ['notify', 'batch'], ['uid' => $item['uid'],
|
$contacts = DBA::select('contact', ['notify', 'batch'], ['uid' => $uid,
|
||||||
'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::ACTIVITYPUB]);
|
'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::ACTIVITYPUB]);
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$contact = defaults($contact, 'batch', $contact['notify']);
|
$contact = defaults($contact, 'batch', $contact['notify']);
|
||||||
|
@ -205,7 +220,7 @@ class ActivityPub
|
||||||
if ($term['type'] != TERM_MENTION) {
|
if ($term['type'] != TERM_MENTION) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$cid = Contact::getIdForURL($term['url'], $item['uid']);
|
$cid = Contact::getIdForURL($term['url'], $uid);
|
||||||
if (!empty($cid) && in_array($cid, $receiver_list)) {
|
if (!empty($cid) && in_array($cid, $receiver_list)) {
|
||||||
$contact = DBA::selectFirst('contact', ['url'], ['id' => $cid, 'network' => Protocol::ACTIVITYPUB]);
|
$contact = DBA::selectFirst('contact', ['url'], ['id' => $cid, 'network' => Protocol::ACTIVITYPUB]);
|
||||||
$profile = self::fetchprofile($contact['url']);
|
$profile = self::fetchprofile($contact['url']);
|
||||||
|
|
|
@ -416,22 +416,14 @@ class Notifier
|
||||||
|
|
||||||
$inboxes = [];
|
$inboxes = [];
|
||||||
|
|
||||||
if ($followup) {
|
|
||||||
$profile = ActivityPub::fetchprofile($parent['author-link']);
|
|
||||||
if (!empty($profile)) {
|
|
||||||
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
|
||||||
$inboxes[$target] = $target;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($target_item['origin']) {
|
if ($target_item['origin']) {
|
||||||
$inboxes = ActivityPub::fetchTargetInboxes($target_item);
|
$inboxes = ActivityPub::fetchTargetInboxes($target_item, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parent['origin']) {
|
if ($parent['origin']) {
|
||||||
$parent_inboxes = ActivityPub::fetchTargetInboxes($parent);
|
$parent_inboxes = ActivityPub::fetchTargetInboxes($parent, $uid);
|
||||||
$inboxes = array_merge($inboxes, $parent_inboxes);
|
$inboxes = array_merge($inboxes, $parent_inboxes);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($inboxes as $inbox) {
|
foreach ($inboxes as $inbox) {
|
||||||
logger('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
|
logger('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
|
||||||
|
|
Loading…
Reference in a new issue