Merge pull request #5004 from annando/missing-posts
Issue 4990: Fixes missing posts on network page
This commit is contained in:
commit
6dda5366de
2 changed files with 9 additions and 34 deletions
|
@ -900,37 +900,12 @@ function conversation_add_children($parents, $block_authors, $order) {
|
||||||
$block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
|
$block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
|
||||||
|
|
||||||
foreach ($parents AS $parent) {
|
foreach ($parents AS $parent) {
|
||||||
$thread_items = dba::p(item_query()." AND `item`.`uid` = ?
|
$thread_items = dba::p(item_query()."AND `item`.`parent-uri` = ?
|
||||||
AND `item`.`parent-uri` = ? $block_sql
|
AND `item`.`uid` IN (0, ?) $block_sql
|
||||||
ORDER BY `item`.`commented` DESC" . $limit,
|
ORDER BY `item`.`uid` ASC, `item`.`commented` DESC" . $limit,
|
||||||
local_user(),
|
$parent['uri'], local_user());
|
||||||
$parent['uri']
|
|
||||||
);
|
|
||||||
$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);
|
$comments = dba::inArray($thread_items);
|
||||||
}
|
|
||||||
|
|
||||||
if (count($comments) != 0) {
|
if (count($comments) != 0) {
|
||||||
$items = array_merge($items, $comments);
|
$items = array_merge($items, $comments);
|
||||||
|
|
|
@ -344,10 +344,10 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = dba::p(item_query()."AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
|
$r = dba::p(item_query()."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
|
||||||
$sql_extra
|
AND `item`.`uid` IN (0, ?) $sql_extra
|
||||||
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
|
ORDER BY `item`.`uid` ASC, `parent` DESC, `gravity` ASC, `id` ASC",
|
||||||
$item_id
|
$item_id, local_user()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
|
|
Loading…
Reference in a new issue