Issue 7367: Only skip DFRN delivery when both author and owner of the post support AP
This commit is contained in:
parent
7ce48d1b77
commit
6170ddf58d
1 changed files with 35 additions and 16 deletions
|
@ -425,14 +425,8 @@ class Notifier
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($rr['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($rr['protocol'] == Protocol::ACTIVITYPUB) &&
|
if (self::skipDFRN($rr, $target_item, $cmd)) {
|
||||||
!in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION, Delivery::POKE])) {
|
Logger::info('Contact can be delivered via AP, so skip delivery via legacy DFRN', ['url' => $rr['url']]);
|
||||||
Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $rr['url']]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config::get('debug', 'total_ap_delivery') && !empty($rr['url']) && ($rr['network'] == Protocol::DFRN) && !empty(APContact::getByURL($rr['url'], false))) {
|
|
||||||
Logger::log('Skipping contact ' . $rr['url'] . ' since it will be delivered via AP', Logger::DEBUG);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,14 +459,8 @@ class Notifier
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($contact['protocol'] == Protocol::ACTIVITYPUB) &&
|
if (self::skipDFRN($contact, $target_item, $cmd)) {
|
||||||
!in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION, Delivery::POKE])) {
|
Logger::info('Contact can be delivered via AP, so skip delivery via legacy DFRN', ['url' => $contact['url']]);
|
||||||
Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $contact['url']]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config::get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
|
|
||||||
Logger::log('Skipping contact ' . $contact['url'] . ' since it will be delivered via AP', Logger::DEBUG);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +535,37 @@ class Notifier
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current delivery process needs to be transported via DFRN.
|
||||||
|
*
|
||||||
|
* @param array $contact Receiver of the post
|
||||||
|
* @param array $item The post
|
||||||
|
* @param string $cmd Notifier command
|
||||||
|
* @return bool
|
||||||
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
* @throws \ImagickException
|
||||||
|
*/
|
||||||
|
private static function skipDFRN($contact, $item, $cmd)
|
||||||
|
{
|
||||||
|
// Don't skip when author or owner don't have AP profiles
|
||||||
|
if (empty(APContact::getByURL($item['author-link'], false)) || empty(APContact::getByURL($item['owner-link'], false))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't skip DFRN delivery for these commands
|
||||||
|
if (in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION, Delivery::POKE])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip DFRN when the 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip DFRN delivery if the contact speaks ActivityPub
|
||||||
|
return in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($contact['protocol'] == Protocol::ACTIVITYPUB);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the current action is a deletion command of a account removal activity
|
* Checks if the current action is a deletion command of a account removal activity
|
||||||
* For Diaspora and ActivityPub we don't need to send single item deletion calls.
|
* For Diaspora and ActivityPub we don't need to send single item deletion calls.
|
||||||
|
|
Loading…
Reference in a new issue