Merge pull request #4506 from annando/fix-update
Fix for network update (number of maximum comments set to 0)
This commit is contained in:
commit
9297f0305f
|
@ -901,7 +901,13 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
|
||||||
* @return array items with parents and comments
|
* @return array items with parents and comments
|
||||||
*/
|
*/
|
||||||
function conversation_add_children($parents, $block_authors, $order) {
|
function conversation_add_children($parents, $block_authors, $order) {
|
||||||
$max_comments = Config::get("system", "max_comments", 100);
|
$max_comments = Config::get('system', 'max_comments', 100);
|
||||||
|
|
||||||
|
if ($max_comments > 0) {
|
||||||
|
$limit = ' LIMIT '.intval($max_comments + 1);
|
||||||
|
} else {
|
||||||
|
$limit = '';
|
||||||
|
}
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
|
@ -910,7 +916,7 @@ function conversation_add_children($parents, $block_authors, $order) {
|
||||||
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`.`uid` = ?
|
||||||
AND `item`.`parent-uri` = ? $block_sql
|
AND `item`.`parent-uri` = ? $block_sql
|
||||||
ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
|
ORDER BY `item`.`commented` DESC" . $limit,
|
||||||
local_user(),
|
local_user(),
|
||||||
$parent['uri']
|
$parent['uri']
|
||||||
);
|
);
|
||||||
|
|
|
@ -857,20 +857,18 @@ function networkThreadedView(App $a, $update = 0)
|
||||||
$parents_arr = [];
|
$parents_arr = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
if ($date_offset < $item['order_date']) {
|
||||||
|
$date_offset = $item['order_date'];
|
||||||
|
}
|
||||||
if (!in_array($item['item_id'], $parents_arr)) {
|
if (!in_array($item['item_id'], $parents_arr)) {
|
||||||
$parents_arr[] = $item['item_id'];
|
$parents_arr[] = $item['item_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$parents_str = implode(', ', $parents_arr);
|
$parents_str = implode(', ', $parents_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_GET, 'offset')) {
|
if (x($_GET, 'offset')) {
|
||||||
$date_offset = $_GET['offset'];
|
$date_offset = $_GET['offset'];
|
||||||
} elseif (count($items)) {
|
|
||||||
$date_offset = $items[0][$order_mode];
|
|
||||||
} else {
|
|
||||||
$date_offset = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->page_offset = $date_offset;
|
$a->page_offset = $date_offset;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user