refine stream filter and forum notification behaviour (mostly for performance). personal posts will be displayed in unthreaded mode and clicking a forum notification will show only the unseen items of the forum in unthreaded mode. group the filters in the widget - threaded at the top, unthreaded beneath.
This commit is contained in:
parent
615402ea83
commit
5c4fbbebe1
@ -128,11 +128,12 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
$xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : '');
|
||||
$net = ((x($_GET,'net')) ? $_GET['net'] : '');
|
||||
$pf = ((x($_GET,'pf')) ? $_GET['pf'] : '');
|
||||
$unseen = ((x($_GET,'unseen')) ? $_GET['unseen'] : '');
|
||||
|
||||
$deftag = '';
|
||||
|
||||
|
||||
if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category)
|
||||
if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category || $conv || $unseen)
|
||||
$nouveau = true;
|
||||
|
||||
if($cid) {
|
||||
@ -220,6 +221,7 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
$sql_extra = '';
|
||||
|
||||
if($group) {
|
||||
|
||||
$contact_str = '';
|
||||
$contacts = group_get_members($group);
|
||||
if($contacts) {
|
||||
@ -232,7 +234,6 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
$item_thread_top = '';
|
||||
|
||||
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
|
||||
|
||||
$x = group_rec_byhash(local_channel(), $group_hash);
|
||||
@ -252,9 +253,20 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($load || $update) {
|
||||
if(!$pf && $nouveau) {
|
||||
// This is for nouveau view cid queries (not a public forum)
|
||||
$sql_extra = " AND author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ";
|
||||
}
|
||||
elseif($pf && $unseen && $nouveau) {
|
||||
|
||||
$ttype = TERM_FORUM;
|
||||
// This is for nouveau view public forum cid queries (if a forum notification is clicked)
|
||||
$p = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'");
|
||||
|
||||
$p = ids_to_querystr($p, 'parent');
|
||||
$sql_extra = " AND ( owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR item.parent IN ( $p ) ) AND item_unseen = 1 ";
|
||||
}
|
||||
else {
|
||||
// This is for threaded view cid queries (e.g. if a forum is selected from the forum filter)
|
||||
$ttype = (($pf) ? TERM_FORUM : TERM_MENTION);
|
||||
|
||||
$p1 = q("SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal ");
|
||||
@ -346,6 +358,7 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
'$net' => $net,
|
||||
'$dbegin' => $datequery2,
|
||||
'$pf' => (($pf) ? $pf : '0'),
|
||||
'$unseen' => $unseen
|
||||
));
|
||||
}
|
||||
|
||||
@ -386,15 +399,7 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($conv) {
|
||||
$item_thread_top = '';
|
||||
|
||||
if($nouveau) {
|
||||
$sql_extra .= " AND author_xchan = '" . dbesc($channel['channel_hash']) . "' ";
|
||||
}
|
||||
else {
|
||||
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan = '%s' or item_mentionsme = 1 )) ",
|
||||
dbesc(protect_sprintf($channel['channel_hash']))
|
||||
);
|
||||
}
|
||||
$sql_extra .= " AND ( author_xchan = '" . dbesc($channel['channel_hash']) . "' OR item_mentionsme = 1 ) ";
|
||||
}
|
||||
|
||||
if($update && ! $load) {
|
||||
@ -442,8 +447,10 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
$page_mode = 'client';
|
||||
|
||||
$simple_update = (($update) ? " and item_unseen = 1 " : '');
|
||||
$parents_str = '';
|
||||
$update_unseen = '';
|
||||
|
||||
$simple_update = (($update) ? " and item_unseen = 1 " : '');
|
||||
|
||||
// This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day
|
||||
// or three and look at your matrix page - after opening up your browser. The first page loads just as it
|
||||
@ -459,6 +466,7 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($update && $_SESSION['loadtime'])
|
||||
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
|
||||
|
||||
if($load)
|
||||
$simple_update = '';
|
||||
|
||||
@ -467,7 +475,6 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($nouveau && $load) {
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
|
||||
$items = q("SELECT item.*, item.id AS item_id, created FROM item
|
||||
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
||||
$net_query
|
||||
@ -479,6 +486,11 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
ORDER BY item.created DESC $pager_sql "
|
||||
);
|
||||
|
||||
$parents_str = ids_to_querystr($items,'item_id');
|
||||
if($parents_str) {
|
||||
$update_unseen = " AND id IN ( " . dbesc($parents_str) . " )";
|
||||
}
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
xchan_query($items);
|
||||
@ -521,8 +533,6 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
// Then fetch all the children of the parents that are on this page
|
||||
$parents_str = '';
|
||||
$update_unseen = '';
|
||||
|
||||
if($r) {
|
||||
|
||||
|
@ -650,7 +650,7 @@ class Ping extends \Zotlabs\Web\Controller {
|
||||
dbesc($forums[$x]['xchan_hash'])
|
||||
);
|
||||
if($r[0]['unseen']) {
|
||||
$forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&cid=' . $forums[$x]['abook_id']);
|
||||
$forums[$x]['notify_link'] = (($forums[$x]['private_forum']) ? $forums[$x]['xchan_url'] : z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id']);
|
||||
$forums[$x]['name'] = $forums[$x]['xchan_name'];
|
||||
$forums[$x]['url'] = $forums[$x]['xchan_url'];
|
||||
$forums[$x]['photo'] = $forums[$x]['xchan_photo_s'];
|
||||
|
@ -16,35 +16,6 @@ class Activity_filter {
|
||||
|
||||
$tabs = [];
|
||||
|
||||
if(feature_enabled(local_channel(),'personal_tab')) {
|
||||
if(x($_GET,'conv')) {
|
||||
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
|
||||
$filter_active = 'personal';
|
||||
}
|
||||
|
||||
$tabs[] = [
|
||||
'label' => t('Personal Posts'),
|
||||
'icon' => 'user-circle',
|
||||
'url' => z_root() . '/' . $cmd . '/?f=&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Show posts that mention or involve me')
|
||||
];
|
||||
}
|
||||
|
||||
if(feature_enabled(local_channel(),'star_posts')) {
|
||||
if(x($_GET,'star')) {
|
||||
$starred_active = (($_GET['star'] == 1) ? 'active' : '');
|
||||
$filter_active = 'star';
|
||||
}
|
||||
|
||||
$tabs[] = [
|
||||
'label' => t('Starred Posts'),
|
||||
'icon' => 'star',
|
||||
'url'=>z_root() . '/' . $cmd . '/?f=&star=1',
|
||||
'sel'=>$starred_active,
|
||||
'title' => t('Show posts that I have starred')
|
||||
];
|
||||
}
|
||||
|
||||
if(Apps::system_app_installed(local_channel(), 'Privacy Groups')) {
|
||||
$groups = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
|
||||
@ -110,6 +81,36 @@ class Activity_filter {
|
||||
}
|
||||
}
|
||||
|
||||
if(feature_enabled(local_channel(),'star_posts')) {
|
||||
if(x($_GET,'star')) {
|
||||
$starred_active = (($_GET['star'] == 1) ? 'active' : '');
|
||||
$filter_active = 'star';
|
||||
}
|
||||
|
||||
$tabs[] = [
|
||||
'label' => t('Starred Posts'),
|
||||
'icon' => 'star',
|
||||
'url'=>z_root() . '/' . $cmd . '/?f=&star=1',
|
||||
'sel'=>$starred_active,
|
||||
'title' => t('Show posts that I have starred')
|
||||
];
|
||||
}
|
||||
|
||||
if(feature_enabled(local_channel(),'personal_tab')) {
|
||||
if(x($_GET,'conv')) {
|
||||
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
|
||||
$filter_active = 'personal';
|
||||
}
|
||||
|
||||
$tabs[] = [
|
||||
'label' => t('Personal Posts'),
|
||||
'icon' => 'user-circle',
|
||||
'url' => z_root() . '/' . $cmd . '/?f=&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Show posts that mention or involve me')
|
||||
];
|
||||
}
|
||||
|
||||
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()),
|
||||
|
@ -54,8 +54,8 @@ class Activity_order {
|
||||
}
|
||||
}
|
||||
|
||||
// override order for search, filer and cid results
|
||||
if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid')) || x($_GET,'verb') || x($_GET,'tag') || x($_GET,'cat')) {
|
||||
// override order for some filter results
|
||||
if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid')) || x($_GET,'verb') || x($_GET,'tag') || x($_GET,'cat') || x($_GET,'conv') || x($_GET,'unseen')) {
|
||||
$unthreaded_active = 'active';
|
||||
$commentord_active = $postord_active = 'disabled';
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
var bParam_verb = "{{$verb}}";
|
||||
var bParam_net = "{{$net}}";
|
||||
var bParam_pf = "{{$pf}}";
|
||||
var bParam_unseen = "{{$unseen}}";
|
||||
|
||||
function buildCmd() {
|
||||
var udargs = ((page_load) ? "/load" : "");
|
||||
@ -62,6 +63,7 @@
|
||||
if(bParam_net != "") bCmd = bCmd + "&net=" + bParam_net;
|
||||
if(bParam_page != 1) bCmd = bCmd + "&page=" + bParam_page;
|
||||
if(bParam_pf != 0) bCmd = bCmd + "&pf=" + bParam_pf;
|
||||
if(bParam_unseen != 0) bCmd = bCmd + "&unseen=" + bParam_unseen;
|
||||
return(bCmd);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user