Only show tagged items when there is no filter active
This commit is contained in:
parent
10b237829f
commit
e2ed1fb426
|
@ -735,7 +735,9 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
}
|
||||
|
||||
if (x($_GET, 'offset')) {
|
||||
$sql_extra3 .= sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
|
||||
$sql_range = sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
|
||||
} else {
|
||||
$sql_range = '';
|
||||
}
|
||||
|
||||
$pager_sql = networkPager($a, $update);
|
||||
|
@ -746,7 +748,7 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
case 'received':
|
||||
if ($last_received != '') {
|
||||
$last_date = $last_received;
|
||||
$sql_extra3 .= sprintf(" AND $sql_table.`received` < '%s'", dbesc($last_received));
|
||||
$sql_range .= sprintf(" AND $sql_table.`received` < '%s'", dbesc($last_received));
|
||||
$a->set_pager_page(1);
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
|
@ -754,7 +756,7 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
case 'commented':
|
||||
if ($last_commented != '') {
|
||||
$last_date = $last_commented;
|
||||
$sql_extra3 .= sprintf(" AND $sql_table.`commented` < '%s'", dbesc($last_commented));
|
||||
$sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", dbesc($last_commented));
|
||||
$a->set_pager_page(1);
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
|
@ -762,14 +764,14 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
case 'created':
|
||||
if ($last_created != '') {
|
||||
$last_date = $last_created;
|
||||
$sql_extra3 .= sprintf(" AND $sql_table.`created` < '%s'", dbesc($last_created));
|
||||
$sql_range .= sprintf(" AND $sql_table.`created` < '%s'", dbesc($last_created));
|
||||
$a->set_pager_page(1);
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
break;
|
||||
case 'id':
|
||||
if (($last_id > 0) && ($sql_table == "`thread`")) {
|
||||
$sql_extra3 .= sprintf(" AND $sql_table.`iid` < '%s'", dbesc($last_id));
|
||||
$sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", dbesc($last_id));
|
||||
$a->set_pager_page(1);
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
|
@ -788,8 +790,8 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted` $sql_extra4
|
||||
AND NOT `item`.`moderated` AND `item`.`unseen`
|
||||
$sql_extra3 $sql_extra $sql_nets
|
||||
ORDER BY `item_id` DESC LIMIT 100",
|
||||
$sql_extra3 $sql_extra $sql_range $sql_nets
|
||||
ORDER BY `order_date` DESC LIMIT 100",
|
||||
intval(local_user())
|
||||
);
|
||||
} else {
|
||||
|
@ -798,16 +800,23 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
|
||||
AND NOT `thread`.`moderated`
|
||||
$sql_extra2 $sql_extra3 $sql_extra $sql_nets
|
||||
$sql_extra2 $sql_extra3 $sql_range $sql_extra $sql_nets
|
||||
ORDER BY $sql_order DESC $pager_sql",
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
||||
if (count($r) > 0) {
|
||||
// Only show it when unfiltered (no groups, no networks, ...)
|
||||
if ((count($r) > 0) && (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4 . $sql_nets) == 0)) {
|
||||
$top_limit = current($r)['order_date'];
|
||||
$bottom_limit = end($r)['order_date'];
|
||||
|
||||
// When checking for updates we need to fetch from the newest date to the newest date before
|
||||
if ($update && !empty($_SESSION['network_last_date']) && ($bottom_limit > $_SESSION['network_last_date'])) {
|
||||
$bottom_limit = $_SESSION['network_last_date'];
|
||||
}
|
||||
$_SESSION['network_last_date'] = $top_limit;
|
||||
|
||||
if ($last_date > $top_limit) {
|
||||
$top_limit = $last_date;
|
||||
}
|
||||
|
@ -822,9 +831,7 @@ function networkThreadedView(App $a, $update = 0) {
|
|||
$data = dba::inArray($items);
|
||||
|
||||
if (count($data) > 0) {
|
||||
logger('Tagged items: '.count($data).' - '.$bottom_limit." - ".$top_limit.' - '.$last_date);
|
||||
|
||||
// ToDo: Doppelte URI rausfiltern
|
||||
logger('Tagged items: '.count($data).' - '.$bottom_limit." - ".$top_limit.' - '.local_user()); //$last_date);
|
||||
$r = array_merge($r, $data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue