Relocate check for announce

This commit is contained in:
Michael 2019-12-08 22:04:32 +00:00
parent 1b0d2f2a4a
commit b8f81d5e7d
2 changed files with 5 additions and 8 deletions

View file

@ -16,7 +16,6 @@ use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -252,13 +251,6 @@ 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)
{ {
// 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']]);
Model\ItemDeliveryData::incrementQueueDone($target_item['id']);
return;
}
// Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
if (Diaspora::isReshare($target_item['body']) && !empty(Diaspora::personByHandle(contact['addr'], false))) { 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']]); Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]);

View file

@ -625,6 +625,11 @@ class Notifier
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 // 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))) { if (Config::get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
return true; return true;