$delivery_contacts_stmt = null;
$target_item = [];
+ $parent = [];
+ $thr_parent = [];
$items = [];
$delivery_queue_count = 0;
$fields = ['network', 'author-id', 'author-link', 'owner-id'];
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
$thr_parent = Item::selectFirst($fields, $condition);
+ if (empty($thr_parent)) {
+ $thr_parent = $parent;
+ }
Logger::log('GUID: ' . $target_item["guid"] . ': Parent is ' . $parent['network'] . '. Thread parent is ' . $thr_parent['network'], Logger::DEBUG);
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
- $allow_people = $aclFormatter->expand($parent['allow_cid'] ?? '');
- $allow_groups = Group::expand($uid, $aclFormatter->expand($parent['allow_gid'] ?? ''),true);
- $deny_people = $aclFormatter->expand($parent['deny_cid'] ?? '');
- $deny_groups = Group::expand($uid, $aclFormatter->expand($parent['deny_gid'] ?? ''));
+ $allow_people = $aclFormatter->expand($parent['allow_cid']);
+ $allow_groups = Group::expand($uid, $aclFormatter->expand($parent['allow_gid']),true);
+ $deny_people = $aclFormatter->expand($parent['deny_cid']);
+ $deny_groups = Group::expand($uid, $aclFormatter->expand($parent['deny_gid']));
// if our parent is a public forum (forum_mode == 1), uplink to the origional author causing
// a delivery fork. private groups (forum_mode == 2) do not uplink
"SELECT
`batch`,
ANY_VALUE(`id`) AS `id`,
+ ANY_VALUE(`url`) AS `url`,
ANY_VALUE(`name`) AS `name`,
ANY_VALUE(`network`) AS `network`,
ANY_VALUE(`protocol`) AS `protocol`
}
if (self::skipDFRN($contact, $target_item, $parent, $thr_parent, $cmd)) {
- Logger::info('Contact can be delivered via AP, so skip delivery via legacy DFRN/Diaspora', ['target' => $target_id, 'url' => contact['url']]);
+ Logger::info('Contact can be delivered via AP, so skip delivery via legacy DFRN/Diaspora', ['target' => $target_id, 'url' => $contact['url']]);
continue;
}
*/
private static function skipDFRN($contact, $item, $parent, $thr_parent, $cmd)
{
+ if (empty($parent['network'])) {
+ return false;
+ }
+
// Don't skip when the starting post is delivered via Diaspora
if ($parent['network'] == Protocol::DIASPORA) {
return false;
return false;
}
+ // We deliver reshares via AP whenever possible
+ if (ActivityPub\Transmitter::isAnnounce($item)) {
+ return true;
+ }
+
// Skip DFRN when the item will be (forcefully) delivered via AP
if (Config::get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
return true;