1
1
Fork 0

Don't transmit content to already archived contacts

This commit is contained in:
Michael Vogel 2019-08-27 21:01:11 +02:00
commit 9b7432781b
5 changed files with 64 additions and 7 deletions

View file

@ -33,7 +33,7 @@ class Delivery extends BaseObject
public static function execute($cmd, $target_id, $contact_id)
{
Logger::log('Invoked: ' . $cmd . ': ' . $target_id . ' to ' . $contact_id, Logger::DEBUG);
Logger::info('Invoked', ['cmd' => $cmd, 'target' => $target_id, 'contact' => $contact_id]);
$top_level = false;
$followup = false;
@ -96,6 +96,14 @@ class Delivery extends BaseObject
return;
}
if (!empty($contact_id) && Model\Contact::isArchived($contact_id)) {
Logger::info('Contact is archived', ['id' => $contact_id, 'cmd' => $cmd, 'item' => $target_item['id']]);
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
Model\ItemDeliveryData::incrementQueueFailed($target_item['id']);
}
return;
}
// avoid race condition with deleting entries
if ($items[0]['deleted']) {
foreach ($items as $item) {

View file

@ -429,6 +429,11 @@ class Notifier
if (DBA::isResult($r)) {
foreach ($r as $rr) {
if (!empty($rr['id']) && Contact::isArchived($rr['id'])) {
Logger::info('Contact is archived', $rr);
continue;
}
if (self::isRemovalActivity($cmd, $owner, $rr['network'])) {
Logger::log('Skipping dropping for ' . $rr['url'] . ' since the network supports account removal commands.', Logger::DEBUG);
continue;
@ -463,6 +468,11 @@ class Notifier
// delivery loop
while ($contact = DBA::fetch($delivery_contacts_stmt)) {
if (!empty($contact['id']) && Contact::isArchived($contact['id'])) {
Logger::info('Contact is archived', $contact);
continue;
}
if (self::isRemovalActivity($cmd, $owner, $contact['network'])) {
Logger::log('Skipping dropping for ' . $contact['url'] . ' since the network supports account removal commands.', Logger::DEBUG);
continue;