diff options
author | friendica <info@friendica.com> | 2014-04-17 20:03:28 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-04-17 20:03:28 -0700 |
commit | 30e2e32f191b0fa9132792e520f02af8c4a6f475 (patch) | |
tree | 90ed3c0a489c73017ae885c127238cfa764c3030 /include | |
parent | 083cf12d48760a553c2ea857bb88c1d2f3902818 (diff) | |
download | volse-hubzilla-30e2e32f191b0fa9132792e520f02af8c4a6f475.tar.gz volse-hubzilla-30e2e32f191b0fa9132792e520f02af8c4a6f475.tar.bz2 volse-hubzilla-30e2e32f191b0fa9132792e520f02af8c4a6f475.zip |
improve zotfeed for discover channel so it will send updates to posts you've already received. Incidentally I discovered why we had the meltdown replying to discover channel items the other day - but can't fix it easily.
Diffstat (limited to 'include')
-rwxr-xr-x | include/items.php | 14 | ||||
-rw-r--r-- | include/security.php | 14 |
2 files changed, 13 insertions, 15 deletions
diff --git a/include/items.php b/include/items.php index f6efea58c..a0a698836 100755 --- a/include/items.php +++ b/include/items.php @@ -3833,18 +3833,19 @@ function zot_feed($uid,$observer_xchan,$mindate) { $items = array(); if(is_sys_channel($uid)) { - require_once('include/security.php'); - $r = q("SELECT item.*, item.id as item_id from item - WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent + $r = q("SELECT distinct parent from item + WHERE uid != %d + and uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 AND (item_flags & %d) and item_private = 0 $sql_extra ORDER BY created ASC $limit", + intval($uid), intval(ITEM_WALL) ); } else { - $r = q("SELECT item.*, item.id as item_id from item - WHERE uid = %d AND item_restrict = 0 and id = parent + $r = q("SELECT distinct parent from item + WHERE uid = %d AND item_restrict = 0 AND (item_flags & %d) $sql_extra ORDER BY created ASC $limit", intval($uid), @@ -3853,7 +3854,7 @@ function zot_feed($uid,$observer_xchan,$mindate) { } if($r) { - $parents_str = ids_to_querystr($r,'id'); + $parents_str = ids_to_querystr($r,'parent'); $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` WHERE `item`.`item_restrict` = 0 @@ -3876,7 +3877,6 @@ function zot_feed($uid,$observer_xchan,$mindate) { $result[] = encode_item($item); return $result; - } diff --git a/include/security.php b/include/security.php index 0edbf854d..f15dea302 100644 --- a/include/security.php +++ b/include/security.php @@ -347,10 +347,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $ret = array(); if(local_user()) $ret[] = local_user(); - $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)", + $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_CENSORED), - intval(PAGE_SYSTEM) + intval(PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED) ); if($r) foreach($r as $rr) @@ -364,7 +363,7 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $str .= ','; $str .= intval($rr); } -logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); + logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); return $str; } @@ -373,10 +372,9 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { if(local_user()) $ret[] = get_observer_hash(); - $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)", + $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_CENSORED), - intval(PAGE_SYSTEM) + intval(PAGE_CENSORED|PAGE_SYETEM|PAGE_REMOVED) ); if($r) foreach($r as $rr) @@ -390,6 +388,6 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { $str .= ','; $str .= "'" . dbesc($rr) . "'"; } -logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); + logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); return $str; } |