]> git.mxchange.org Git - friendica.git/commitdiff
Don't deliver nested comments to Diaspora if the previous comment wasn't from Diaspora
authorMichael <heluecht@pirati.ca>
Sun, 28 Jul 2019 19:13:17 +0000 (19:13 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 28 Jul 2019 19:13:17 +0000 (19:13 +0000)
src/Worker/Delivery.php
src/Worker/Notifier.php

index 261065ae9aadb4fc9f87cdeedff08ae974731249..ab3e3a6e0bdc3023bbd66833bea917bfdd6e9ef5 100644 (file)
@@ -185,19 +185,6 @@ class Delivery extends BaseObject
                                self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
                                break;
 
-                       case Protocol::OSTATUS:
-                               // Do not send to otatus if we are not configured to send to public networks
-                               if ($owner['prvnets']) {
-                                       break;
-                               }
-                               if (Config::get('system','ostatus_disabled') || Config::get('system','dfrn_only')) {
-                                       break;
-                               }
-
-                               // There is currently no code here to distribute anything to OStatus.
-                               // This is done in "notifier.php" (See "url_recipients" and "push_notify")
-                               break;
-
                        case Protocol::MAIL:
                                self::deliverMail($cmd, $contact, $owner, $target_item);
                                break;
@@ -374,6 +361,7 @@ class Delivery extends BaseObject
                if (Config::get('system', 'dfrn_only') || !Config::get('system', 'diaspora_enabled')) {
                        return;
                }
+
                if ($cmd == self::MAIL) {
                        Diaspora::sendMail($target_item, $owner, $contact);
                        return;
@@ -382,6 +370,7 @@ class Delivery extends BaseObject
                if ($cmd == self::SUGGESTION) {
                        return;
                }
+
                if (!$contact['pubkey'] && !$public_message) {
                        return;
                }
index 7531a639d79ea45bac71c34d6bc5e66f3b24bb08..42ad0afb6dccaaae72d85e14d0e242eb04890c5c 100644 (file)
@@ -149,12 +149,19 @@ class Notifier
                                $delivery_queue_count += self::activityPubDelivery($cmd, $target_item, $parent, $a->queue['priority'], $a->queue['created'], $owner);
                        }
 
-                       $fields = ['network', 'author-id', 'owner-id'];
+                       $fields = ['network', 'author-id', 'author-link', 'owner-id'];
                        $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
                        $thr_parent = Item::selectFirst($fields, $condition);
 
                        Logger::log('GUID: ' . $target_item["guid"] . ': Parent is ' . $parent['network'] . '. Thread parent is ' . $thr_parent['network'], Logger::DEBUG);
 
+                       // Only deliver threaded replies (comment to a comment) to Diaspora
+                       // when the original comment author does support the Diaspora protocol.
+                       if ($target_item['parent-uri'] != $target_item['thr-parent']) {
+                               $diaspora_delivery = Diaspora::isSupportedByContactUrl($thr_parent['author-link']);
+                               Logger::info('Threaded comment', ['diaspora_delivery' => (int)$diaspora_delivery]);
+                       }
+
                        // This is IMPORTANT!!!!
 
                        // We will only send a "notify owner to relay" or followup message if the referenced post
@@ -349,9 +356,11 @@ class Notifier
                                }
 
                                // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
-                               $networks = [Protocol::OSTATUS, Protocol::DFRN];
+                               $networks = [Protocol::DFRN];
+                       } elseif ($diaspora_delivery) {
+                               $networks = [Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
                        } else {
-                               $networks = [Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
+                               $networks = [Protocol::DFRN, Protocol::MAIL];
                        }
                } else {
                        $public_message = false;