]> git.mxchange.org Git - friendica.git/commitdiff
Process deletions via ActivityPub
authorMichael <heluecht@pirati.ca>
Sat, 2 Nov 2024 17:35:49 +0000 (17:35 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 3 Nov 2024 06:10:25 +0000 (06:10 +0000)
src/Model/Contact.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Util/HTTPSignature.php
src/Worker/Notifier.php

index a440d1e59915d6f9e15d39aeac45fb8cab712a6c..a9ef2276ab9e730e402b92fc33fbfe82d7b69cb3 100644 (file)
@@ -1082,7 +1082,7 @@ class Contact
         */
        public static function markForArchival(array $contact)
        {
-               if ((!isset($contact['url']) || !isset($contact['uri-id'])) && !empty($contact['id'])) {
+               if ((!isset($contact['uri-id']) || !isset($contact['url']) || !isset($contact['archive']) || !isset($contact['self']) || !isset($contact['term-date'])) && !empty($contact['id'])) {
                        $fields = ['id', 'uri-id', 'url', 'archive', 'self', 'term-date'];
                        $contact = DBA::selectFirst('contact', $fields, ['id' => $contact['id']]);
                        if (!DBA::isResult($contact)) {
index ad53f22a214c60ab6d1f957c61ce405debf3ab64..883a97c10acffe3dd6c5eaa5b0adcd939ff60972 100644 (file)
@@ -1391,7 +1391,7 @@ class Transmitter
                        }
                }
 
-               if (!$api_mode && !$item['origin']) {
+               if (!$api_mode && !$item['deleted'] && !$item['origin']) {
                        Logger::debug('Post is not ours and is not stored', ['id' => $item['id'], 'uri-id' => $item['uri-id']]);
                        return false;
                }
index 7b82adaf9117cd5dec4c5130850265168ef295a9..8ea8dfd37aff148c858a01dc4962bfac82bf5e05 100644 (file)
@@ -986,7 +986,7 @@ class DFRN
                        Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
                        return -25;
                }
-               Item::incrementOutbound(Protocol::DFRN);
+
                $xml = $postResult->getBodyString();
 
                $curl_stat = $postResult->getReturnCode();
@@ -1017,6 +1017,7 @@ class DFRN
 
                if (!empty($contact['gsid'])) {
                        GServer::setReachableById($contact['gsid'], Protocol::DFRN);
+                       Item::incrementOutbound(Protocol::DFRN);
                }
 
                if (!empty($res->message)) {
index 94fec1b00dc04e103900d11340132d70eee46932..74963025e997b474e99154ff0383db164af35190 100644 (file)
@@ -2962,7 +2962,6 @@ class Diaspora
                                return 0;
                        }
                        $return_code = $postResult->getReturnCode();
-                       Item::incrementOutbound(Protocol::DIASPORA);
                } else {
                        Logger::notice('test_mode');
                        return 200;
@@ -2971,6 +2970,7 @@ class Diaspora
                if (!empty($contact['gsid']) && (empty($return_code) || $postResult->isTimeout())) {
                        GServer::setFailureById($contact['gsid']);
                } elseif (!empty($contact['gsid']) && ($return_code >= 200) && ($return_code <= 299)) {
+                       Item::incrementOutbound(Protocol::DIASPORA);
                        GServer::setReachableById($contact['gsid'], Protocol::DIASPORA);
                }
 
index 68bd049855cc6ac65e0656fb64e1c7aad1eeadc3..0fdfccf33052c8595fbeb44348b10fc32481f28e 100644 (file)
@@ -297,7 +297,9 @@ class HTTPSignature
 
                self::setInboxStatus($target, ($return_code >= 200) && ($return_code <= 299));
 
-               Item::incrementOutbound(Protocol::ACTIVITYPUB);
+               if (($return_code >= 200) && ($return_code <= 299)) {
+                       Item::incrementOutbound(Protocol::ACTIVITYPUB);
+               }
 
                return $postResult;
        }
index 760d324d2ddc562520a5505984a0e48b7484d1cd..f693d3da53ea128b0959658fbe8d95add1ee2df0 100644 (file)
@@ -527,7 +527,7 @@ class Notifier
                                continue;
                        }
 
-                       Logger::info('Delivery', ['batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'guid' => $target_item['guid'] ?? '', 'to' => $contact]);
+                       Logger::info('Delivery', ['cmd' => $cmd, 'batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'guid' => $target_item['guid'] ?? '', 'to' => $contact]);
 
                        // Ensure that posts with our own protocol arrives before Diaspora posts arrive.
                        // Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first.