- $sql_extra = 'AND `thread`.`iid` <= ' . intval($max_id);
- }
-
- $r = dba::p(
- "SELECT " . item_fieldlists() . "
- FROM `thread`
- STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
- " . item_joins(api_user()) . "
- STRAIGHT_JOIN `user` ON `user`.`uid` = `thread`.`uid`
- AND NOT `user`.`hidewall`
- AND `verb` = ?
- AND NOT `thread`.`private`
- AND `thread`.`wall`
- AND `thread`.`visible`
- AND NOT `thread`.`deleted`
- AND NOT `thread`.`moderated`
- AND `thread`.`iid` > ?
- $sql_extra
- ORDER BY `thread`.`iid` DESC
- LIMIT " . intval($start) . ", " . intval($count),
- ACTIVITY_POST,
- $since_id
- );
+ $condition[0] .= " AND `thread`.`iid` <= ?";
+ $condition[] = $max_id;
+ }
+
+ $params = ['order' => ['iid' => true], 'limit' => [$start, $count]];
+ $statuses = Item::selectThreadForUser(api_user(), Item::DISPLAY_FIELDLIST, $condition, $params);