From aa047278cc07a004e290f10bae9b7784e07e2fe2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Dec 2019 09:01:06 +0000 Subject: [PATCH] Reversed annouce check to have priority for AP --- src/Worker/Delivery.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index cc06f1792..e901e45f2 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -251,6 +251,12 @@ class Delivery extends BaseObject */ private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup) { + // Skip transmitting the announce via DFRN when it had already been done via AP + if (ActivityPub\Transmitter::isAnnounce($target_item) && !empty(Model\APContact::getByURL($contact['url'], false))) { + Logger::info('Announce had already been transmitted', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]); + return; + } + // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora if (Diaspora::isReshare($target_item['body']) && !empty(Diaspora::personByHandle(contact['addr'], false))) { Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]); @@ -258,12 +264,6 @@ class Delivery extends BaseObject return; } - // Skip transmitting the announce via DFRN when it had already been done via AP - if (ActivityPub\Transmitter::isAnnounce($target_item) && !empty(Model\APContact::getByURL($contact['url'], false))) { - Logger::info('Announce had already been transmitted', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]); - return; - } - Logger::info('Deliver ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' via DFRN to ' . (($contact['addr'] ?? '') ?: $contact['url'])); if ($cmd == self::MAIL) {