]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge pull request #4511 from annando/no-activity
[friendica.git] / include / conversation.php
index 5a18e4d201bf8879531ba73a9df6b6137ccf0de2..c7a2379d539353f0bc07a623aef54695e7b6430f 100644 (file)
@@ -905,7 +905,13 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
  * @return array items with parents and comments
  */
 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 = [];
 
@@ -914,7 +920,7 @@ function conversation_add_children($parents, $block_authors, $order) {
        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 ".intval($max_comments + 1),
+                       ORDER BY `item`.`commented` DESC" . $limit,
                        local_user(),
                        $parent['uri']
                );