]> git.mxchange.org Git - friendica.git/commitdiff
Issue 4990: Fixes missing posts on network page
authorMichael <heluecht@pirati.ca>
Tue, 8 May 2018 22:00:32 +0000 (22:00 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 8 May 2018 22:00:32 +0000 (22:00 +0000)
include/conversation.php

index ae12cf4827de6b8c0c6e3b3222f108ebd39698d0..2a558cfca6c3cc1269db772009969d67c187f755 100644 (file)
@@ -900,37 +900,12 @@ function conversation_add_children($parents, $block_authors, $order) {
        $block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
 
        foreach ($parents AS $parent) {
-               $thread_items = dba::p(item_query()." AND `item`.`uid` = ?
-                       AND `item`.`parent-uri` = ? $block_sql
-                       ORDER BY `item`.`commented` DESC" . $limit,
-                       local_user(),
-                       $parent['uri']
-               );
-               $comments = dba::inArray($thread_items);
+               $thread_items = dba::p(item_query()."AND `item`.`parent-uri` = ?
+                       AND `item`.`uid` IN (0, ?) $block_sql
+                       ORDER BY `parent` DESC, `gravity` ASC, `id` ASC" . $limit,
+                       $parent['uri'], local_user());
 
-               // 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 = [];
-                       }
-               }
-
-               if (count($comments) == 0) {
-                       $thread_items = dba::p(item_query()." AND `item`.`uid` = 0
-                               AND `item`.`parent-uri` = ?
-                               ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
-                               $parent['uri']
-                       );
-                       $comments = dba::inArray($thread_items);
-               }
+               $comments = dba::inArray($thread_items);
 
                if (count($comments) != 0) {
                        $items = array_merge($items, $comments);