$uid = self::getCurrentUserID();
$request = $this->getRequest([
- 'max_id' => 0, // Return results older than id
+ 'max_id' => '0', // Return results older than id
'since_id' => 0, // Return results newer than id
- 'min_id' => 0, // Return results immediately newer than id
+ 'min_id' => '0', // Return results immediately newer than id
'limit' => 20, // Maximum number of results to return. Defaults to 20.
'local' => false, // Return only local statuses?
'with_muted' => false, // Pleroma extension: return activities by muted (not by blocked!) users.
'only_media' => false, // Show only statuses with media attached? Defaults to false.
'remote' => false, // Show only remote statuses? Defaults to false.
'exclude_replies' => false, // Don't show comments
- 'min_time' => '',
- 'max_time' => '',
'friendica_order' => TimelineOrderByTypes::ID,
], $request);
try {
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
switch ($request['friendica_order']) {
- case TimelineOrderByTypes::CREATED_AT:
+ case TimelineOrderByTypes::CREATED:
self::setBoundaries($status->createdAtTimestamp());
break;
case TimelineOrderByTypes::ID:
$requested_order = $request['friendica_order'];
if ($requested_order == TimelineOrderByTypes::ID) {
if (!empty($request['max_id'])) {
- $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);
+ $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", intval($request['max_id'])]);
}
if (!empty($request['since_id'])) {
- $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['since_id']]);
+ $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", intval($request['since_id'])]);
}
if (!empty($request['min_id'])) {
- $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['min_id']]);
+ $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", intval($request['min_id'])]);
}
} else {
switch ($requested_order) {
- case TimelineOrderByTypes::CREATED_AT:
+ case TimelineOrderByTypes::CREATED:
$order_field = 'created';
break;
default:
$order_field = 'uri-id';
}
- if (!empty($request['max_time'])) {
- $condition = DBA::mergeConditions($condition, ["`$order_field` < ?", DateTimeFormat::convert($request['max_time'], DateTimeFormat::MYSQL)]);
+ if (!empty($request['max_id'])) {
+ $condition = DBA::mergeConditions($condition, ["`$order_field` < ?", DateTimeFormat::convert($request['max_id'], DateTimeFormat::MYSQL)]);
}
- if (!empty($request['min_time'])) {
- $condition = DBA::mergeConditions($condition, ["`$order_field` > ?", DateTimeFormat::convert($request['min_time'], DateTimeFormat::MYSQL)]);
+ if (!empty($request['min_id'])) {
+ $condition = DBA::mergeConditions($condition, ["`$order_field` > ?", DateTimeFormat::convert($request['min_id'], DateTimeFormat::MYSQL)]);
$params['order'] = [$order_field];
}
unset($request['min_id']);
unset($request['max_id']);
unset($request['since_id']);
- unset($request['min_time']);
- unset($request['max_time']);
$prev_request = $next_request = $request;
$max_date->setTimestamp(self::$boundaries['max']);
$min_date = new DateTime();
$min_date->setTimestamp(self::$boundaries['min']);
- $prev_request['min_time'] = $max_date->format(DateTimeFormat::JSON);
- $next_request['max_time'] = $min_date->format(DateTimeFormat::JSON);
+ $prev_request['min_id'] = $max_date->format(DateTimeFormat::JSON);
+ $next_request['max_id'] = $min_date->format(DateTimeFormat::JSON);
} else {
$prev_request['min_id'] = self::$boundaries['max'];
$next_request['max_id'] = self::$boundaries['min'];