1
0
Fork 0

Merge pull request #7153 from annando/ap-mail-delivery

Fix receiver list for mails
This commit is contained in:
Hypolite Petovan 2019-05-18 11:50:10 -04:00 committed by GitHub
commit fc312e4c98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 36 deletions

View file

@ -422,6 +422,7 @@ class Transmitter
} }
} }
if (!empty($item['parent'])) {
$parents = Item::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], ['parent' => $item['parent']]); $parents = Item::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], ['parent' => $item['parent']]);
while ($parent = Item::fetch($parents)) { while ($parent = Item::fetch($parents)) {
if ($parent['gravity'] == GRAVITY_PARENT) { if ($parent['gravity'] == GRAVITY_PARENT) {
@ -439,7 +440,7 @@ class Transmitter
} }
} }
} else { } else {
// Public thread parent post always are directed to the followes // Public thread parent post always are directed to the followers
if (!$item['private'] && !$forum_mode) { if (!$item['private'] && !$forum_mode) {
$data['cc'][] = $actor_profile['followers']; $data['cc'][] = $actor_profile['followers'];
} }
@ -462,6 +463,7 @@ class Transmitter
} }
} }
DBA::close($parents); DBA::close($parents);
}
$data['to'] = array_unique($data['to']); $data['to'] = array_unique($data['to']);
$data['cc'] = array_unique($data['cc']); $data['cc'] = array_unique($data['cc']);

View file

@ -78,7 +78,7 @@ class Notifier
$recipients[] = $message['contact-id']; $recipients[] = $message['contact-id'];
$mail = ActivityPub\Transmitter::ItemArrayFromMail($target_id); $mail = ActivityPub\Transmitter::ItemArrayFromMail($target_id);
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($mail, §uid, true); $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($mail, $uid, true);
foreach ($inboxes as $inbox) { foreach ($inboxes as $inbox) {
Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_id, 'inbox' => $inbox]); Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_id, 'inbox' => $inbox]);
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true], Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true],
@ -441,8 +441,8 @@ class Notifier
continue; continue;
} }
if (($rr['network'] == Protocol::DFRN) && ($rr['protocol'] == Protocol::ACTIVITYPUB) && if (in_array($rr['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($rr['protocol'] == Protocol::ACTIVITYPUB) &&
!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { !in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) {
Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $rr['url']]); Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $rr['url']]);
continue; continue;
} }
@ -481,8 +481,8 @@ class Notifier
continue; continue;
} }
if (($contact['network'] == Protocol::DFRN) && ($contact['protocol'] == Protocol::ACTIVITYPUB) && if (in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($contact['protocol'] == Protocol::ACTIVITYPUB) &&
!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { !in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) {
Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $contact['url']]); Logger::info('Contact is Friendica AP, so skipping delivery via legacy DFRN', ['url' => $contact['url']]);
continue; continue;
} }