]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Notifier.php
Merge remote-tracking branch 'upstream/develop' into post-delivery-data
[friendica.git] / src / Worker / Notifier.php
index b3741e546d2ee27a3c2810a076681649a9ea5d11..b93b1dd74b094fb8998f895449762d94a66731f6 100644 (file)
@@ -32,7 +32,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Conversation;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
-use Friendica\Model\ItemDeliveryData;
+use Friendica\Model\Post;
 use Friendica\Model\PushSubscriber;
 use Friendica\Model\User;
 use Friendica\Network\Probe;
@@ -151,6 +151,8 @@ class Notifier
                // If this is a public conversation, notify the feed hub
                $public_message = true;
 
+               $unlisted = false;
+
                // Do a PuSH
                $push_notify = false;
 
@@ -183,6 +185,8 @@ class Notifier
                                Logger::info('Threaded comment', ['diaspora_delivery' => (int)$diaspora_delivery]);
                        }
 
+                       $unlisted = $target_item['private'] == Item::UNLISTED;
+
                        // This is IMPORTANT!!!!
 
                        // We will only send a "notify owner to relay" or followup message if the referenced post
@@ -245,8 +249,7 @@ class Notifier
 
                                Logger::info('Followup', ['target' => $target_id, 'guid' => $target_item['guid'], 'to' => $parent['contact-id']]);
 
-                               //if (!$target_item['private'] && $target_item['wall'] &&
-                               if (!$target_item['private'] &&
+                               if (($target_item['private'] != Item::PRIVATE) &&
                                        (strlen($target_item['allow_cid'].$target_item['allow_gid'].
                                                $target_item['deny_cid'].$target_item['deny_gid']) == 0))
                                        $push_notify = true;
@@ -410,7 +413,7 @@ class Notifier
                if ($public_message && !in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION]) && !$followup) {
                        $relay_list = [];
 
-                       if ($diaspora_delivery) {
+                       if ($diaspora_delivery && !$unlisted) {
                                $batch_delivery = true;
 
                                $relay_list_stmt = DBA::p(
@@ -438,7 +441,7 @@ class Notifier
 
                                // Fetch the participation list
                                // The function will ensure that there are no duplicates
-                               $relay_list = Diaspora::participantsForThread($target_id, $relay_list);
+                               $relay_list = Diaspora::participantsForThread($parent, $relay_list);
 
                                // Add the relay to the list, avoid duplicates.
                                // Don't send community posts to the relay. Forum posts via the Diaspora protocol are looking ugly.
@@ -570,7 +573,7 @@ class Notifier
                                /// @TODO Redeliver/queue these items on failure, though there is no contact record
                                $delivery_queue_count++;
                                Salmon::slapper($owner, $url, $slap);
-                               ItemDeliveryData::incrementQueueDone($target_id, ItemDeliveryData::OSTATUS);
+                               Post\DeliveryData::incrementQueueDone($target_item['uri-id'], Post\DeliveryData::OSTATUS);
                        }
                }
 
@@ -592,11 +595,11 @@ class Notifier
                        // Workaround for pure connector posts
                        if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
                                if ($delivery_queue_count == 0) {
-                                       ItemDeliveryData::incrementQueueDone($target_item['id']);
+                                       Post\DeliveryData::incrementQueueDone($target_item['uri-id']);
                                        $delivery_queue_count = 1;
                                }
 
-                               ItemDeliveryData::incrementQueueCount($target_item['id'], $delivery_queue_count);
+                               Post\DeliveryData::incrementQueueCount($target_item['uri-id'], $delivery_queue_count);
                        }
                }