]> git.mxchange.org Git - friendica.git/commitdiff
Precaution for incomplete threads
authorMichael <heluecht@pirati.ca>
Thu, 4 Jan 2018 20:59:19 +0000 (20:59 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 4 Jan 2018 20:59:19 +0000 (20:59 +0000)
include/conversation.php

index 0a565c68e343adb27cf23387aa05774e8d40a259..5edcb09da2cff9984cc53835fcca1347d8264397 100644 (file)
@@ -929,6 +929,20 @@ function community_add_items($parents) {
                );
                $comments = dba::inArray($thread_items);
 
+               // Check if the original item is in the result.
+               // When commenting from the community page there can be incomplete threads
+               if (count($comments) > 0) {
+                       $parent_found = false;
+                       foreach ($comments as $comment) {
+                               if ($comment['uri'] == $comment['parent-uri']) {
+                                       $parent_found = true;
+                                       break;
+                               }
+                       }
+                       if (!$parent_found) {
+                               $comments = array();
+                       }
+               }
 
                if (count($comments) == 0) {
                        $thread_items = dba::p(item_query()." AND `item`.`uid` = 0