add new conv_sort option

This commit is contained in:
zotlabs 2017-08-23 20:02:28 -07:00
parent 64cf36a2b5
commit f2e802229a
2 changed files with 7 additions and 1 deletions

View file

@ -159,7 +159,7 @@ class Cards extends \Zotlabs\Web\Controller {
if($items) {
xchan_query($items);
$items = fetch_post_tags($items, true);
$items = conv_sort($items,'created');
$items = conv_sort($items,'updated');
}
else
$items = [];

View file

@ -1461,6 +1461,8 @@ function conv_sort($arr, $order) {
usort($parents,'sort_thr_created');
elseif(stristr($order,'commented'))
usort($parents,'sort_thr_commented');
elseif(stristr($order,'updated'))
usort($parents,'sort_thr_updated');
elseif(stristr($order,'ascending'))
usort($parents,'sort_thr_created_rev');
@ -1502,6 +1504,10 @@ function sort_thr_commented($a,$b) {
return strcmp($b['commented'],$a['commented']);
}
function sort_thr_updated($a,$b) {
return strcmp($b['updated'],$a['updated']);
}
function find_thread_parent_index($arr,$x) {
foreach($arr as $k => $v)
if($v['id'] == $x['parent'])