From e52a2edcf4bf8f61960833c8882346258055a6a8 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jan 2018 00:14:58 +0000 Subject: [PATCH 1/2] Filtering by network type in hash tag following is now possible --- mod/network.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mod/network.php b/mod/network.php index 1e6832541..9d999d242 100644 --- a/mod/network.php +++ b/mod/network.php @@ -629,7 +629,8 @@ function networkThreadedView(App $a, $update = 0) { $sql_post_table = " INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`"; } - $sql_nets = (($nets) ? sprintf(" and $sql_table.`network` = '%s' ", dbesc($nets)) : ''); + $sql_nets = (($nets) ? sprintf(" AND $sql_table.`network` = '%s' ", dbesc($nets)) : ''); + $sql_tag_nets = (($nets) ? sprintf(" AND `item`.`network` = '%s' ", dbesc($nets)) : ''); if ($gid) { $group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => $_SESSION['uid']]); @@ -808,7 +809,7 @@ function networkThreadedView(App $a, $update = 0) { } // Only show it when unfiltered (no groups, no networks, ...) - if (Config::get('system', 'comment_public') && (count($r) > 0) && (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4 . $sql_nets) == 0)) { + if (Config::get('system', 'comment_public') && (count($r) > 0) && (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4) == 0)) { $top_limit = current($r)['order_date']; $bottom_limit = end($r)['order_date']; @@ -827,7 +828,7 @@ function networkThreadedView(App $a, $update = 0) { (SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term` ON `item`.`id` = `term`.`oid` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `item`.`uid` = 0 AND `item`.$ordering < ? AND `item`.$ordering > ?", + WHERE `item`.`uid` = 0 AND `item`.$ordering < ? AND `item`.$ordering > ?".$sql_tag_nets, local_user(), TERM_OBJ_POST, TERM_HASHTAG, $top_limit, $bottom_limit); $data = dba::inArray($items); From eee3ae96171d08f68d1a4b0d952ddf8183ab5736 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jan 2018 00:23:45 +0000 Subject: [PATCH 2/2] Only filter for hash tags on federated networks --- mod/network.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/network.php b/mod/network.php index 9d999d242..9b6e3f1c3 100644 --- a/mod/network.php +++ b/mod/network.php @@ -809,7 +809,8 @@ function networkThreadedView(App $a, $update = 0) { } // Only show it when unfiltered (no groups, no networks, ...) - if (Config::get('system', 'comment_public') && (count($r) > 0) && (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4) == 0)) { + if (Config::get('system', 'comment_public') && (count($r) > 0) && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) + && (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4) == 0)) { $top_limit = current($r)['order_date']; $bottom_limit = end($r)['order_date'];