Only sort the profile after pinned
This commit is contained in:
parent
463c9131b6
commit
91ad7936f3
2 changed files with 22 additions and 14 deletions
|
@ -1451,7 +1451,9 @@ function conv_sort(array $item_list, $order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stristr($order, 'received')) {
|
if (stristr($order, 'pinned_received')) {
|
||||||
|
usort($parents, 'sort_thr_pinned_received');
|
||||||
|
} elseif (stristr($order, 'received')) {
|
||||||
usort($parents, 'sort_thr_received');
|
usort($parents, 'sort_thr_received');
|
||||||
} elseif (stristr($order, 'commented')) {
|
} elseif (stristr($order, 'commented')) {
|
||||||
usort($parents, 'sort_thr_commented');
|
usort($parents, 'sort_thr_commented');
|
||||||
|
@ -1488,6 +1490,24 @@ function conv_sort(array $item_list, $order)
|
||||||
return $parents;
|
return $parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief usort() callback to sort item arrays by pinned and the received key
|
||||||
|
*
|
||||||
|
* @param array $a
|
||||||
|
* @param array $b
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function sort_thr_pinned_received(array $a, array $b)
|
||||||
|
{
|
||||||
|
if ($b['pinned'] && !$a['pinned']) {
|
||||||
|
return 1;
|
||||||
|
} elseif (!$b['pinned'] && $a['pinned']) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return strcmp($b['received'], $a['received']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief usort() callback to sort item arrays by the received key
|
* @brief usort() callback to sort item arrays by the received key
|
||||||
*
|
*
|
||||||
|
@ -1497,12 +1517,6 @@ function conv_sort(array $item_list, $order)
|
||||||
*/
|
*/
|
||||||
function sort_thr_received(array $a, array $b)
|
function sort_thr_received(array $a, array $b)
|
||||||
{
|
{
|
||||||
if ($b['pinned'] && !$a['pinned']) {
|
|
||||||
return 1;
|
|
||||||
} elseif (!$b['pinned'] && $a['pinned']) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return strcmp($b['received'], $a['received']);
|
return strcmp($b['received'], $a['received']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1515,12 +1529,6 @@ function sort_thr_received(array $a, array $b)
|
||||||
*/
|
*/
|
||||||
function sort_thr_received_rev(array $a, array $b)
|
function sort_thr_received_rev(array $a, array $b)
|
||||||
{
|
{
|
||||||
if ($b['pinned'] && !$a['pinned']) {
|
|
||||||
return -1;
|
|
||||||
} elseif (!$b['pinned'] && $a['pinned']) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return strcmp($a['received'], $b['received']);
|
return strcmp($a['received'], $b['received']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ class Profile extends BaseModule
|
||||||
$items = array_merge($items, $pinned);
|
$items = array_merge($items, $pinned);
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'received', $a->profile['profile_uid']);
|
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'pinned_received', $a->profile['profile_uid']);
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$o .= $pager->renderMinimal(count($items));
|
$o .= $pager->renderMinimal(count($items));
|
||||||
|
|
Loading…
Reference in a new issue