fix some weirdness on the zot feed
This commit is contained in:
parent
7b3c29ebe6
commit
79dacc3f1a
@ -1128,6 +1128,8 @@ function conv_sort($arr,$order) {
|
|||||||
usort($parents,'sort_thr_created');
|
usort($parents,'sort_thr_created');
|
||||||
elseif(stristr($order,'commented'))
|
elseif(stristr($order,'commented'))
|
||||||
usort($parents,'sort_thr_commented');
|
usort($parents,'sort_thr_commented');
|
||||||
|
elseif(stristr($order,'ascending'))
|
||||||
|
usort($parents,'sort_thr_created_rev');
|
||||||
|
|
||||||
if(count($parents))
|
if(count($parents))
|
||||||
foreach($parents as $i=>$_x)
|
foreach($parents as $i=>$_x)
|
||||||
|
@ -4743,28 +4743,37 @@ function zot_feed($uid,$observer_xchan,$mindate) {
|
|||||||
$sql_extra .= " and created > '$mindate' ";
|
$sql_extra .= " and created > '$mindate' ";
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
$limit = 50;
|
||||||
// We probably should use two queries and pick up total conversations.
|
$items = array();
|
||||||
// For now get a chunk of raw posts in ascending created order so that
|
|
||||||
// hopefully the parent is imported before we see the kids.
|
|
||||||
// This will fail if there are more than $limit kids and you didn't
|
|
||||||
// receive the parent via direct delivery
|
|
||||||
|
|
||||||
$limit = 200;
|
$r = q("SELECT item.*, item.id as item_id from item
|
||||||
|
WHERE uid = %d AND item_restrict = 0 and id = parent
|
||||||
$items = q("SELECT item.* from item
|
|
||||||
WHERE uid = %d AND item_restrict = 0
|
|
||||||
AND (item_flags & %d)
|
AND (item_flags & %d)
|
||||||
$sql_extra ORDER BY created ASC limit 0, $limit",
|
$sql_extra ORDER BY created ASC limit 0, $limit",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval(ITEM_WALL)
|
intval(ITEM_WALL)
|
||||||
);
|
);
|
||||||
|
if($r) {
|
||||||
|
|
||||||
|
$parents_str = ids_to_querystr($r,'id');
|
||||||
|
|
||||||
|
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
||||||
|
WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0
|
||||||
|
AND `item`.`parent` IN ( %s ) ",
|
||||||
|
intval($uid),
|
||||||
|
dbesc($parents_str)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($items) {
|
if($items) {
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items);
|
||||||
} else {
|
$items = conv_sort($items,'ascending');
|
||||||
$items = array();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$items = array();
|
||||||
|
|
||||||
foreach($items as $item)
|
foreach($items as $item)
|
||||||
$result[] = encode_item($item);
|
$result[] = encode_item($item);
|
||||||
|
@ -9,7 +9,7 @@ function zotfeed_init(&$a) {
|
|||||||
|
|
||||||
$mindate = (($_REQUEST['mindate']) ? datetime_convert('UTC','UTC',$_REQUEST['mindate']) : '');
|
$mindate = (($_REQUEST['mindate']) ? datetime_convert('UTC','UTC',$_REQUEST['mindate']) : '');
|
||||||
if(! $mindate)
|
if(! $mindate)
|
||||||
$mindate = '0000-00-00 00:00:00';
|
$mindate = datetime_convert('UTC','UTC', 'now - 1 month');
|
||||||
|
|
||||||
if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) {
|
if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) {
|
||||||
$result['message'] = 'Public access denied';
|
$result['message'] = 'Public access denied';
|
||||||
|
Reference in New Issue
Block a user