- // Not sure why this query was so complicated. We should keep it here for a while,
- // just to make sure that we really don't need it.
- // FROM `item` INNER JOIN (SELECT `uri`,`parent` FROM `item` WHERE `id` = %d) AS `temp1`
- // ON (`item`.`thr-parent` = `temp1`.`uri` AND `item`.`parent` = `temp1`.`parent`)
-
- $r = q(
- "SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
- `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
- `contact`.`id` AS `cid`
- FROM `item`
- STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
- AND (NOT `contact`.`blocked` OR `contact`.`pending`)
- WHERE `item`.`parent` = %d AND `item`.`visible`
- AND NOT `item`.`moderated` AND NOT `item`.`deleted`
- AND `item`.`uid` = %d AND `item`.`verb` = '%s'
- AND `item`.`id`>%d $sql_extra
- ORDER BY `item`.`id` DESC LIMIT %d ,%d",
- intval($id),
- intval(api_user()),
- dbesc(ACTIVITY_POST),
- intval($since_id),
- intval($start),
- intval($count)
- );
+ $params = ['order' => ['id' => true], 'limit' => [$start, $count]];
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);