Issue 4990: Fixes missing posts on network page
This commit is contained in:
parent
f8139d1179
commit
14833edb2d
1 changed files with 5 additions and 30 deletions
|
@ -900,38 +900,13 @@ 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']
|
||||
);
|
||||
$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());
|
||||
|
||||
$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 = [];
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (count($comments) != 0) {
|
||||
$items = array_merge($items, $comments);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue