From c4778e5e2494d262c18dd73815fb495964355fce Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 9 Jun 2018 10:58:01 +0200 Subject: restrict cid filter to unthreaded order (makes much more sense that way imho and the query is a lot faster) and slighty change order of the filters --- Zotlabs/Widget/Activity_filter.php | 65 +++++++++++++++++++------------------- Zotlabs/Widget/Activity_order.php | 4 +-- 2 files changed, 34 insertions(+), 35 deletions(-) (limited to 'Zotlabs/Widget') diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index 78e439fdd..fadf39144 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -76,6 +76,38 @@ class Activity_filter { } } + if(feature_enabled(local_channel(),'forums_tab')) { + $forums = get_forum_channels(local_channel()); + + if($forums) { + foreach($forums as $f) { + if(x($_GET,'pf') && x($_GET,'cid')) { + $forum_active = ((x($_GET,'pf') && $_GET['cid'] == $f['abook_id']) ? 'active' : ''); + $filter_active = 'forums'; + } + $fsub[] = [ + 'label' => $f['xchan_name'], + 'img' => $f['xchan_photo_s'], + 'url' => (($f['private_forum']) ? $f['xchan_url'] : z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id']), + 'sel' => $forum_active, + 'title' => t('Show posts to this forum'), + 'lock' => (($f['private_forum']) ? 'lock' : '') + ]; + } + + $tabs[] = [ + 'id' => 'forums', + 'label' => t('Forums'), + 'icon' => 'comments-o', + 'url' => '#', + 'sel' => (($filter_active == 'forums') ? true : false), + 'title' => t('Show forums'), + 'sub' => $fsub + + ]; + } + } + if(feature_enabled(local_channel(),'filing')) { $terms = q("select distinct term from term where uid = %d and ttype = %d order by term asc", intval(local_channel()), @@ -110,39 +142,6 @@ class Activity_filter { } } - if(feature_enabled(local_channel(),'forums_tab')) { - $forums = get_forum_channels(local_channel()); - - if($forums) { - foreach($forums as $f) { - if(x($_GET,'pf') && x($_GET,'cid')) { - $forum_active = ((x($_GET,'pf') && $_GET['cid'] == $f['abook_id']) ? 'active' : ''); - $filter_active = 'forums'; - } - $fsub[] = [ - 'label' => $f['xchan_name'], - 'img' => $f['xchan_photo_s'], - 'url' => (($f['private_forum']) ? $f['xchan_url'] : z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id']), - 'sel' => $forum_active, - 'title' => t('Show posts to this forum'), - 'lock' => (($f['private_forum']) ? 'lock' : '') - ]; - } - - $tabs[] = [ - 'id' => 'forums', - 'label' => t('Forums'), - 'icon' => 'comments-o', - 'url' => '#', - 'sel' => (($filter_active == 'forums') ? true : false), - 'title' => t('Show forums'), - 'sub' => $fsub - - ]; - } - } - - if(x($_GET,'search')) { $filter_active = 'search'; $tabs[] = [ diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php index 534d6caee..0e660afc3 100644 --- a/Zotlabs/Widget/Activity_order.php +++ b/Zotlabs/Widget/Activity_order.php @@ -53,8 +53,8 @@ class Activity_order { } } - // override order for search results and filer results - if(x($_GET,'search') || x($_GET,'file')) { + // override order for search, filer and cid results + if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid'))) { $unthreaded_active = 'active'; $commentord_active = $postord_active = 'disabled'; } -- cgit v1.2.3