aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php15
-rw-r--r--mod/network.php38
2 files changed, 32 insertions, 21 deletions
diff --git a/mod/channel.php b/mod/channel.php
index b484f0f60..4fd7a6481 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -161,14 +161,16 @@ function channel_content(&$a, $update = 0) {
if($update) {
-
$r = q("SELECT distinct(parent) AS `item_id` from item
+ left join abook on item.author_xchan = abook.abook_xchan
WHERE uid = %d AND item_restrict = 0
- AND item_flags & %d
+ AND (item_flags & %d)
+ AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra
ORDER BY created DESC",
intval($a->profile['profile_uid']),
- intval(ITEM_WALL)
+ intval(ITEM_WALL|ITEM_UNSEEN|ITEM_THREAD_TOP),
+ intval(ABOOK_FLAG_BLOCKED)
);
}
@@ -191,12 +193,15 @@ function channel_content(&$a, $update = 0) {
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
$r = q("SELECT id AS item_id FROM item
+ left join abook on item.author_xchan = abook.abook_xchan
WHERE uid = %d AND item_restrict = 0
- AND item_flags & %d
+ AND (item_flags & %d)
+ AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra $sql_extra2
ORDER BY created DESC $pager_sql ",
intval($a->profile['profile_uid']),
- intval(ITEM_WALL|ITEM_THREAD_TOP)
+ intval(ITEM_WALL|ITEM_THREAD_TOP),
+ intval(ABOOK_FLAG_BLOCKED)
);
diff --git a/mod/network.php b/mod/network.php
index b4b736e28..6e1148b90 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -589,20 +589,22 @@ function network_content(&$a, $update = 0, $load = false) {
if(($cmin != 0) || ($cmax != 99)) {
- $sql_nets .= " AND abook.abook_closeness >= " . intval($cmin) . " ";
- $sql_nets .= " AND abook.abook_closeness <= " . intval($cmax) . " ";
+ // Not everybody who shows up in the network stream will be in your address book.
+ // By default those that aren't are assumed to have closeness = 99; but this isn't
+ // recorded anywhere. So if cmax is 99, we'll open the search up to anybody in
+ // the stream with a NULL address book entry.
- // This is ugly - but we won't have an abook for everybody as we
- // used to have a contact for everybody in Friendica.
- // Might be an unknown poster (99) or our own post (0).
- // Need to refactor this after a solution presents itself
+ $sql_nets .= " AND ";
if($cmax == 99)
- $sql_nets .= " OR ( abook.abook_id = NULL AND item.author_xchan != '" . $ch['channel_hash'] . " ) ";
- if($cmin == 0 && local_user()) {
- $ch = $a->get_channel();
- $sql_nets .= " OR ( item.author_xchan = '" . $ch['channel_hash'] . "' ) ";
- }
+ $sql_nets .= " ( ";
+
+ $sql_nets .= "( abook.abook_closeness >= " . intval($cmin) . " ";
+ $sql_nets .= " AND abook.abook_closeness <= " . intval($cmax) . " ) ";
+
+ if($cmax == 99)
+ $sql_nets .= " OR abook.abook_closeness IS NULL ) ";
+
}
@@ -640,13 +642,15 @@ function network_content(&$a, $update = 0, $load = false) {
$ordering = "`commented`";
// Fetch a page full of parent items for this page
-dbg(1);
+
if($update && (! $load)) {
$r = q("SELECT item.parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
- WHERE item.uid = %d AND item.item_restrict = 0
+ WHERE item.uid = %d AND item.item_restrict = 0
+ and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets ",
- intval(local_user())
+ intval(local_user()),
+ intval(ABOOK_FLAG_BLOCKED)
);
}
else {
@@ -655,13 +659,15 @@ dbg(1);
left join abook on item.author_xchan = abook.abook_xchan
WHERE item.uid = %d AND item.item_restrict = 0
AND item.parent = item.id
+ and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
ORDER BY item.$ordering DESC $pager_sql ",
- intval(local_user())
+ intval(local_user()),
+ intval(ABOOK_FLAG_BLOCKED)
);
}
-dbg(0);
+
// Then fetch all the children of the parents that are on this page
if($r && count($r)) {