AP: Debug option to deliver via AP first
This commit is contained in:
parent
5d43d521d3
commit
fc0acd7b1f
|
@ -425,5 +425,9 @@ return [
|
|||
// ap_inbox_log (Boolean)
|
||||
// Logs every call to /inbox as a JSON file in Friendica's temporary directory
|
||||
'ap_inbox_log' => false,
|
||||
|
||||
// total_ap_delivery (Boolean)
|
||||
// Deliver via AP to every possible receiver and we suppress the delivery to these contacts with other protocols
|
||||
'total_ap_delivery' => false,
|
||||
]
|
||||
];
|
||||
|
|
|
@ -325,11 +325,13 @@ class Transmitter
|
|||
}
|
||||
}
|
||||
|
||||
if (Config::get('debug', 'total_ap_delivery')) {
|
||||
// Will be activated in a later step
|
||||
// $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||
|
||||
$networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||
} else {
|
||||
// For now only send to these contacts:
|
||||
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
|
||||
}
|
||||
|
||||
$data = ['to' => [], 'cc' => [], 'bcc' => []];
|
||||
|
||||
|
@ -473,11 +475,13 @@ class Transmitter
|
|||
{
|
||||
$inboxes = [];
|
||||
|
||||
if (Config::get('debug', 'total_ap_delivery')) {
|
||||
// Will be activated in a later step
|
||||
// $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||
|
||||
$networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||
} else {
|
||||
// For now only send to these contacts:
|
||||
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
|
||||
}
|
||||
|
||||
$condition = ['uid' => $uid, 'network' => $networks, 'archive' => false, 'pending' => false];
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -418,12 +419,17 @@ class Notifier
|
|||
$condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'archive' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]];
|
||||
|
||||
$r2 = DBA::toArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
|
||||
$r2 = DBA::toArray(DBA::select('contact', ['id', 'url', 'name', 'network'], $condition));
|
||||
|
||||
$r = array_merge($r2, $relay_list);
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
foreach ($r as $rr) {
|
||||
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;
|
||||
}
|
||||
|
||||
$conversants[] = $rr['id'];
|
||||
|
||||
$delivery_queue_count++;
|
||||
|
@ -447,6 +453,11 @@ class Notifier
|
|||
|
||||
// delivery loop
|
||||
while ($contact = DBA::fetch($delivery_contacts_stmt)) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Don't deliver to Diaspora if it already had been done as batch delivery
|
||||
if (($contact['network'] == Protocol::DIASPORA) && $batch_delivery) {
|
||||
Logger::log('Already delivered id ' . $target_id . ' via batch to ' . json_encode($contact), Logger::DEBUG);
|
||||
|
|
Loading…
Reference in a new issue