aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php2
-rwxr-xr-xinclude/items.php33
2 files changed, 23 insertions, 12 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 1023c068d..61b563a5d 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1128,6 +1128,8 @@ function conv_sort($arr,$order) {
usort($parents,'sort_thr_created');
elseif(stristr($order,'commented'))
usort($parents,'sort_thr_commented');
+ elseif(stristr($order,'ascending'))
+ usort($parents,'sort_thr_created_rev');
if(count($parents))
foreach($parents as $i=>$_x)
diff --git a/include/items.php b/include/items.php
index b22c02955..2d0966518 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4743,28 +4743,37 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$sql_extra .= " and created > '$mindate' ";
-// FIXME
- // We probably should use two queries and pick up total conversations.
- // 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;
+ $limit = 50;
+ $items = array();
- $items = q("SELECT item.* from item
- WHERE uid = %d AND item_restrict = 0
+ $r = q("SELECT item.*, item.id as item_id from item
+ WHERE uid = %d AND item_restrict = 0 and id = parent
AND (item_flags & %d)
$sql_extra ORDER BY created ASC limit 0, $limit",
intval($uid),
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) {
xchan_query($items);
$items = fetch_post_tags($items);
- } else {
- $items = array();
+ $items = conv_sort($items,'ascending');
+
}
+ else
+ $items = array();
foreach($items as $item)
$result[] = encode_item($item);