Fix since_id and max_id API parameters for inbox-based loads; was failing if the exact id mentioned wasn't present in the inbox (or had been trimmed out)
This commit is contained in:
parent
ef016dca45
commit
745d428365
|
@ -154,17 +154,23 @@ class Inbox extends Memcached_DataObject
|
||||||
$ids = unpack('N*', $inbox->notice_ids);
|
$ids = unpack('N*', $inbox->notice_ids);
|
||||||
|
|
||||||
if (!empty($since_id)) {
|
if (!empty($since_id)) {
|
||||||
$i = array_search($since_id, $ids);
|
$newids = array();
|
||||||
if ($i !== false) {
|
foreach ($ids as $id) {
|
||||||
$ids = array_slice($ids, 0, $i - 1);
|
if ($id > $since_id) {
|
||||||
|
$newids[] = $id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$ids = $newids;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($max_id)) {
|
if (!empty($max_id)) {
|
||||||
$i = array_search($max_id, $ids);
|
$newids = array();
|
||||||
if ($i !== false) {
|
foreach ($ids as $id) {
|
||||||
$ids = array_slice($ids, $i - 1);
|
if ($id <= $max_id) {
|
||||||
|
$newids[] = $id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$ids = $newids;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids = array_slice($ids, $offset, $limit);
|
$ids = array_slice($ids, $offset, $limit);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user