]> git.mxchange.org Git - friendica.git/commitdiff
Don't create the parent during a deletion
authorMichael <heluecht@pirati.ca>
Sun, 6 Dec 2020 09:54:34 +0000 (09:54 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 6 Dec 2020 09:54:34 +0000 (09:54 +0000)
src/Protocol/DFRN.php
src/Worker/Delivery.php

index 312aae5f7b448b74e6198a43bf0ee57fac4301da..35bbffede52f70e2627ea3a158fdfd3dc9afe161 100644 (file)
@@ -2705,8 +2705,12 @@ class DFRN
                }
 
                $deletions = $xpath->query("/atom:feed/at:deleted-entry");
-               foreach ($deletions as $deletion) {
-                       self::processDeletion($xpath, $deletion, $importer);
+               if (!empty($deletions)) {
+                       foreach ($deletions as $deletion) {
+                               self::processDeletion($xpath, $deletion, $importer);
+                       }
+                       Logger::notice('Deletions had been processed');
+                       return 200;
                }
 
                if (!$sort_by_date) {
index fc24faef62609a56a3ab9a003639c08ae4358009..8a84f34a2f07f0c562da6d28b06b151e1b2561ab 100644 (file)
@@ -296,13 +296,17 @@ class Delivery
                        $msgitems = [$target_item];
                        $atom = DFRN::entries($msgitems, $owner);
                } else {
-                       $msgitems = [];
-                       foreach ($items as $item) {
-                               // Only add the parent when we don't delete other items.
-                               if (($target_item['id'] == $item['id']) || ($cmd != self::DELETION)) {
-                                       $item["entry:comment-allow"] = true;
-                                       $item["entry:cid"] = ($top_level ? $contact['id'] : 0);
-                                       $msgitems[] = $item;
+                       if ($target_item['deleted']) {
+                               $msgitems = [$target_item];
+                       } else {
+                               $msgitems = [];
+                               foreach ($items as $item) {
+                                       // Only add the parent when we don't delete other items.
+                                       if (($target_item['id'] == $item['id']) || ($cmd != self::DELETION)) {
+                                               $item["entry:comment-allow"] = true;
+                                               $item["entry:cid"] = ($top_level ? $contact['id'] : 0);
+                                               $msgitems[] = $item;
+                                       }
                                }
                        }
                        $atom = DFRN::entries($msgitems, $owner);