From 83f670e9e555aa37dbdcfa4e104cb4c71c1c861b Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 7 Oct 2019 04:19:12 +0000 Subject: [PATCH] Test against the thread parent as well --- src/Worker/Delivery.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 66bd669a07..8652885630 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -102,6 +102,14 @@ class Delivery extends BaseObject return; } + $condition = ['uri' => $target_item['thr-parent'], 'uid' => $target_item['uid']]; + $thr_parent = Model\Item::selectFirst(['network'], $condition); + if (!DBA::isResult($thr_parent)) { + // Shouldn't happen. But when this does, we just take the parent as thread parent. + // That's totally okay for what we use this variable here. + $thr_parent = $parent; + } + if (!empty($contact_id) && Model\Contact::isArchived($contact_id)) { Logger::info('Contact is archived', ['id' => $contact_id, 'cmd' => $cmd, 'item' => $target_item['id']]); self::setFailedQueue($cmd, $target_id); @@ -182,9 +190,10 @@ class Delivery extends BaseObject return; } - // Transmit via Diaspora if the thread had started as Diaspora post + // Transmit via Diaspora if the thread had started as Diaspora post. + // Also transmit via Diaspora if this is a direct answer to a Diaspora comment. // This is done since the uri wouldn't match (Diaspora doesn't transmit it) - if (isset($parent) && ($parent['network'] == Protocol::DIASPORA)) { + if (!empty($parent) && !empty($thr_parent) && in_array(Protocol::DIASPORA, [$parent['network'], $thr_parent['network']])) { $contact['network'] = Protocol::DIASPORA; }