Improve the queries on the network page

This commit is contained in:
Michael 2018-02-25 21:33:15 +00:00
parent 9fc0e02bf9
commit a1eb5a584f
2 changed files with 52 additions and 51 deletions

View file

@ -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) {
function conversation(App $a, $items, $mode, $update, $preview = false, $ordering = '') {
require_once 'mod/proxy.php';
$ssl_state = ((local_user()) ? true : false);
@ -520,6 +520,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$previewing = (($preview) ? ' preview ' : '');
if ($mode === 'network') {
$items = community_add_items($items, $ordering);
$profile_owner = local_user();
if (!$update) {
/*
@ -580,7 +581,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
. " var profile_page = 1; </script>";
}
} elseif ($mode === 'community') {
$items = community_add_items($items);
$items = community_add_items($items, $ordering);
$profile_owner = 0;
if (!$update) {
$live_update_div = '<div id="live-community"></div>' . "\r\n"
@ -899,7 +900,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
*
* @return array items with parents and comments
*/
function community_add_items($parents) {
function community_add_items($parents, $ordering = "`commented`") {
$max_comments = Config::get("system", "max_comments", 100);
$items = [];
@ -949,7 +950,7 @@ function community_add_items($parents) {
}
}
$items = conv_sort($items, "`commented`");
$items = conv_sort($items, $ordering);
return $items;
}