]> git.mxchange.org Git - friendica.git/commitdiff
Detect the thread parent id if it is missing
authorMichael <heluecht@pirati.ca>
Thu, 29 Sep 2022 13:48:10 +0000 (13:48 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 29 Sep 2022 13:48:10 +0000 (13:48 +0000)
src/Protocol/ActivityPub/Processor.php

index ad4d6272135e74e415d7a745501bd1aec2deb0b7..cadf982139042e2ffe8eb21bbe513d4a6b14ae13 100644 (file)
@@ -980,6 +980,13 @@ class Processor
                                continue;
                        }
 
+                       if (($receiver != 0) && empty($item['parent-uri-id']) && !empty($item['thr-parent-id'])) {
+                               $parent = Post::selectFirst(['parent-uri-id'], ['uri-id' => $item['thr-parent-id'], 'uid' => [0, $receiver]]);
+                               if (!empty($parent['parent-uri-id'])) {
+                                       $item['parent-uri-id'] = $parent['parent-uri-id'];
+                               }
+                       }
+
                        $item['uid'] = $receiver;
 
                        $type = $activity['reception_type'][$receiver] ?? Receiver::TARGET_UNKNOWN;