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.
This commit is contained in:
parent
083cf12d48
commit
30e2e32f19
@ -3833,18 +3833,19 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
if(is_sys_channel($uid)) {
|
if(is_sys_channel($uid)) {
|
||||||
|
|
||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
$r = q("SELECT item.*, item.id as item_id from item
|
$r = q("SELECT distinct parent from item
|
||||||
WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent
|
WHERE uid != %d
|
||||||
|
and uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0
|
||||||
AND (item_flags & %d)
|
AND (item_flags & %d)
|
||||||
and item_private = 0 $sql_extra ORDER BY created ASC $limit",
|
and item_private = 0 $sql_extra ORDER BY created ASC $limit",
|
||||||
|
intval($uid),
|
||||||
intval(ITEM_WALL)
|
intval(ITEM_WALL)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$r = q("SELECT item.*, item.id as item_id from item
|
$r = q("SELECT distinct parent from item
|
||||||
WHERE uid = %d AND item_restrict = 0 and id = parent
|
WHERE uid = %d AND item_restrict = 0
|
||||||
AND (item_flags & %d)
|
AND (item_flags & %d)
|
||||||
$sql_extra ORDER BY created ASC $limit",
|
$sql_extra ORDER BY created ASC $limit",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
@ -3853,7 +3854,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($r) {
|
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`
|
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
||||||
WHERE `item`.`item_restrict` = 0
|
WHERE `item`.`item_restrict` = 0
|
||||||
@ -3876,7 +3877,6 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
$result[] = encode_item($item);
|
$result[] = encode_item($item);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,10 +347,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
if(local_user())
|
if(local_user())
|
||||||
$ret[] = 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($perms_min),
|
||||||
intval(PAGE_CENSORED),
|
intval(PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED)
|
||||||
intval(PAGE_SYSTEM)
|
|
||||||
);
|
);
|
||||||
if($r)
|
if($r)
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
@ -373,10 +372,9 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
|
|||||||
if(local_user())
|
if(local_user())
|
||||||
$ret[] = get_observer_hash();
|
$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($perms_min),
|
||||||
intval(PAGE_CENSORED),
|
intval(PAGE_CENSORED|PAGE_SYETEM|PAGE_REMOVED)
|
||||||
intval(PAGE_SYSTEM)
|
|
||||||
);
|
);
|
||||||
if($r)
|
if($r)
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
|
@ -21,8 +21,9 @@ function zotfeed_init(&$a) {
|
|||||||
|
|
||||||
$channel_address = ((argc() > 1) ? argv(1) : '');
|
$channel_address = ((argc() > 1) ? argv(1) : '');
|
||||||
if($channel_address) {
|
if($channel_address) {
|
||||||
$r = q("select channel_id, channel_name from channel where channel_address = '%s' limit 1",
|
$r = q("select channel_id, channel_name from channel where channel_address = '%s' and not (channel_pageflags & %d) limit 1",
|
||||||
dbesc(argv(1))
|
dbesc(argv(1)),
|
||||||
|
intval(PAGE_REMOVED)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user