From d2728cad2e023776b4a90c358456ba831d957428 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 26 Feb 2018 06:38:27 +0000 Subject: [PATCH] Children for the network page are now fetched correctly in the conversation --- include/conversation.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 302d923946..b262ee4c82 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -496,7 +496,7 @@ function item_condition() { * that are based on unique features of the calling module. * */ -function conversation(App $a, $items, $mode, $update, $preview = false, $ordering = '') { +function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'commented') { require_once 'mod/proxy.php'; $ssl_state = ((local_user()) ? true : false); @@ -520,7 +520,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $orderin $previewing = (($preview) ? ' preview ' : ''); if ($mode === 'network') { - $items = community_add_items($items, $ordering); + $items = conversation_add_children($items, false, $order); $profile_owner = local_user(); if (!$update) { /* @@ -581,7 +581,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $orderin . " var profile_page = 1; "; } } elseif ($mode === 'community') { - $items = community_add_items($items, $ordering); + $items = conversation_add_children($items, true, $order); $profile_owner = 0; if (!$update) { $live_update_div = '
' . "\r\n" @@ -900,15 +900,16 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $orderin * * @return array items with parents and comments */ -function community_add_items($parents, $ordering = "`commented`") { +function conversation_add_children($parents, $block_authors, $order) { $max_comments = Config::get("system", "max_comments", 100); $items = []; + $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` = ? - AND NOT `author`.`hidden` AND NOT `author`.`blocked` + AND `item`.`parent-uri` = ? $block_sql ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1), local_user(), $parent['uri'] @@ -950,7 +951,7 @@ function community_add_items($parents, $ordering = "`commented`") { } } - $items = conv_sort($items, $ordering); + $items = conv_sort($items, $order); return $items; } -- 2.39.5