Fix bug items sync for the Fever api

This commit is contained in:
Frédéric Guillot 2014-11-08 22:33:50 -05:00
parent 906f99cf1c
commit 4fa894925e

View File

@ -128,22 +128,9 @@ route('items', function() {
if ($response['auth']) {
$offset = 0;
$direction = 'ASC';
if (isset($_GET['since_id']) && is_numeric($_GET['since_id'])) {
$offset = $_GET['since_id'];
$direction = 'ASC';
}
else if (isset($_GET['max_id']) && is_numeric($_GET['max_id'])) {
$offset = $_GET['max_id'];
$direction = 'DESC';
}
$query = Database::get('db')
->table('items')
->limit(50)
->columns(
'rowid',
'feed_id',
@ -154,12 +141,14 @@ route('items', function() {
'updated',
'status',
'bookmark'
)
->orderby('rowid', $direction)
->offset($offset)
->limit(50);
);
if (! empty($_GET['with_ids'])) {
if (isset($_GET['since_id']) && is_numeric($_GET['since_id'])) {
$items = $query->gt('rowid', $_GET['since_id'])
->asc('rowid');
}
else if (! empty($_GET['with_ids'])) {
$query->in('rowid', explode(',', $_GET['with_ids']));
}