]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Delivery.php
Don't transmit content to already archived contacts
[friendica.git] / src / Worker / Delivery.php
index 7733d3f575364407af538302beb90275f0a42ded..eb86f910dd9dcb03eca57b66c2a21ae7a7cf234d 100644 (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) {