]> git.mxchange.org Git - friendica.git/commitdiff
Issue 10651: Improved logging
authorMichael <heluecht@pirati.ca>
Sat, 4 Sep 2021 04:51:20 +0000 (04:51 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 4 Sep 2021 04:51:20 +0000 (04:51 +0000)
src/Worker/Delivery.php
src/Worker/Notifier.php

index 55a0cf96d012cd201f93542436de31c569201fb9..8961b3f13d71d935f8947b05204117fe28a1993e 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\Protocol\Email;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Network;
 use Friendica\Core\Worker;
-use Friendica\Model\Conversation;
 use Friendica\Model\FContact;
 use Friendica\Model\Item;
 use Friendica\Protocol\Relay;
@@ -210,7 +209,8 @@ class Delivery
                // Also transmit via Diaspora if this is a direct answer to a Diaspora comment.
                // This is done since the uri wouldn't match (Diaspora doesn't transmit it)
                // Also transmit relayed posts from Diaspora contacts via Diaspora.
-               if (!empty($parent) && !empty($thr_parent) && in_array(Protocol::DIASPORA, [$parent['network'], $thr_parent['network'], $target_item['network']])) {
+               if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network']])) {
+                       Logger::info('Enforcing the Diaspora protocol', ['id' => $contact['id'], 'network' => $contact['network'], 'parent' => $parent['network'], 'thread-parent' => $thr_parent['network'], 'post' => $target_item['network']]);
                        $contact['network'] = Protocol::DIASPORA;
                }
 
index ef2d8983978c90b4ff71714c47aedf805ce98340..a53eefa7d17d354440350dea75297a1671dea220 100644 (file)
@@ -179,7 +179,7 @@ class Notifier
                                $thr_parent = $parent;
                        }
 
-                       Logger::log('GUID: ' . $target_item["guid"] . ': Parent is ' . $parent['network'] . '. Thread parent is ' . $thr_parent['network'], Logger::DEBUG);
+                       Logger::info('Got post', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'network' => $target_item['network'], 'parent-network' => $parent['network'], 'thread-parent-network' => $thr_parent['network']]);
 
                        if (!self::isRemovalActivity($cmd, $owner, Protocol::ACTIVITYPUB)) {
                                $apdelivery = self::activityPubDelivery($cmd, $target_item, $parent, $thr_parent, $a->getQueueValue('priority'), $a->getQueueValue('created'), $owner);
@@ -732,21 +732,25 @@ class Notifier
        {
                // Don't deliver via AP when the starting post isn't from a federated network
                if (!in_array($parent['network'], Protocol::FEDERATED)) {
+                       Logger::info('Parent network is no federated network, so no AP delivery', ['network' => $parent['network']]);
                        return ['count' => 0, 'contacts' => []];
                }
 
                // Don't deliver via AP when the starting post is delivered via Diaspora
                if ($parent['network'] == Protocol::DIASPORA) {
+                       Logger::info('Parent network is Diaspora, so no AP delivery');
                        return ['count' => 0, 'contacts' => []];
                }
 
                // Also don't deliver when the direct thread parent was delivered via Diaspora
                if ($thr_parent['network'] == Protocol::DIASPORA) {
+                       Logger::info('Threat parent network is Diaspora, so no AP delivery');
                        return ['count' => 0, 'contacts' => []];
                }
 
                // Posts from Diaspora contacts are transmitted via Diaspora
                if ($target_item['network'] == Protocol::DIASPORA) {
+                       Logger::info('Post network is Diaspora, so no AP delivery');
                        return ['count' => 0, 'contacts' => []];
                }