Ensure that local delivery is done via DFRN
This commit is contained in:
parent
a5895f8623
commit
e6a054696d
|
@ -197,6 +197,11 @@ class Delivery
|
||||||
$contact['network'] = Protocol::DIASPORA;
|
$contact['network'] = Protocol::DIASPORA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that local contacts are delivered locally
|
||||||
|
if (Model\Contact::isLocal($contact['url'])) {
|
||||||
|
$contact['network'] = Protocol::DFRN;
|
||||||
|
}
|
||||||
|
|
||||||
Logger::notice('Delivering', ['cmd' => $cmd, 'target' => $target_id, 'followup' => $followup, 'network' => $contact['network']]);
|
Logger::notice('Delivering', ['cmd' => $cmd, 'target' => $target_id, 'followup' => $followup, 'network' => $contact['network']]);
|
||||||
|
|
||||||
switch ($contact['network']) {
|
switch ($contact['network']) {
|
||||||
|
@ -287,11 +292,8 @@ class Delivery
|
||||||
|
|
||||||
Logger::debug('Notifier entry: ' . $contact["url"] . ' ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' entry: ' . $atom);
|
Logger::debug('Notifier entry: ' . $contact["url"] . ' ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' entry: ' . $atom);
|
||||||
|
|
||||||
$basepath = implode('/', array_slice(explode('/', $contact['url']), 0, 3));
|
|
||||||
|
|
||||||
// perform local delivery if we are on the same site
|
// perform local delivery if we are on the same site
|
||||||
|
if (Model\Contact::isLocal($contact['url'])) {
|
||||||
if (Strings::compareLink($basepath, DI::baseUrl())) {
|
|
||||||
$condition = ['nurl' => Strings::normaliseLink($contact['url']), 'self' => true];
|
$condition = ['nurl' => Strings::normaliseLink($contact['url']), 'self' => true];
|
||||||
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
|
$target_self = DBA::selectFirst('contact', ['uid'], $condition);
|
||||||
if (!DBA::isResult($target_self)) {
|
if (!DBA::isResult($target_self)) {
|
||||||
|
|
|
@ -444,6 +444,11 @@ class Notifier
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
|
// Ensure that local contacts are delivered via DFRN
|
||||||
|
if (Contact::isLocal($rr['url'])) {
|
||||||
|
$contact['network'] == Protocol::DFRN;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($rr['addr']) && ($rr['network'] == Protocol::ACTIVITYPUB) && !DBA::exists('fcontact', ['addr' => $rr['addr']])) {
|
if (!empty($rr['addr']) && ($rr['network'] == Protocol::ACTIVITYPUB) && !DBA::exists('fcontact', ['addr' => $rr['addr']])) {
|
||||||
Logger::info('Contact is AP omly', ['target' => $target_id, 'contact' => $rr['url']]);
|
Logger::info('Contact is AP omly', ['target' => $target_id, 'contact' => $rr['url']]);
|
||||||
continue;
|
continue;
|
||||||
|
@ -489,6 +494,11 @@ class Notifier
|
||||||
|
|
||||||
// delivery loop
|
// delivery loop
|
||||||
while ($contact = DBA::fetch($delivery_contacts_stmt)) {
|
while ($contact = DBA::fetch($delivery_contacts_stmt)) {
|
||||||
|
// Ensure that local contacts are delivered via DFRN
|
||||||
|
if (Contact::isLocal($contact['url'])) {
|
||||||
|
$contact['network'] == Protocol::DFRN;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($contact['addr']) && ($contact['network'] == Protocol::ACTIVITYPUB) && !DBA::exists('fcontact', ['addr' => $contact['addr']])) {
|
if (!empty($contact['addr']) && ($contact['network'] == Protocol::ACTIVITYPUB) && !DBA::exists('fcontact', ['addr' => $contact['addr']])) {
|
||||||
Logger::info('Contact is AP omly', ['target' => $target_id, 'contact' => $contact['url']]);
|
Logger::info('Contact is AP omly', ['target' => $target_id, 'contact' => $contact['url']]);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue