Transmit reshares and announce natively via Diaspora and AP whenever possible

This commit is contained in:
Michael 2019-12-08 08:59:21 +00:00
parent ca0a961ad2
commit 7ccbe3ee29
1 changed files with 7 additions and 5 deletions

View File

@ -251,17 +251,19 @@ class Delivery extends BaseObject
*/ */
private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup) private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup)
{ {
/* // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
if (Diaspora::isReshare($target_item['body'])) { if (Diaspora::isReshare($target_item['body']) && !empty(Diaspora::personByHandle(contact['addr'], false))) {
// Transmit Diaspora reshares only via Diaspora Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup); self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
return; return;
} }
if (ActivityPub\Transmitter::::isAnnounce($target_item) && getby) { // 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; return;
} }
*/
Logger::info('Deliver ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' via DFRN to ' . (($contact['addr'] ?? '') ?: $contact['url'])); Logger::info('Deliver ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' via DFRN to ' . (($contact['addr'] ?? '') ?: $contact['url']));
if ($cmd == self::MAIL) { if ($cmd == self::MAIL) {