mirror of
https://github.com/flarum/framework.git
synced 2024-11-27 19:13:37 +08:00
Actually use the calculated offset
This commit is contained in:
parent
0f3d7ceafe
commit
c58fc07798
|
@ -9,10 +9,10 @@ trait GetsPosts
|
||||||
$user = $request->actor->getUser();
|
$user = $request->actor->getUser();
|
||||||
|
|
||||||
if (isset($where['discussion_id']) && ($near = $request->get('near')) > 1) {
|
if (isset($where['discussion_id']) && ($near = $request->get('near')) > 1) {
|
||||||
$start = $this->posts->getIndexForNumber($where['discussion_id'], $near, $user);
|
$offset = $this->posts->getIndexForNumber($where['discussion_id'], $near, $user);
|
||||||
$start = max(0, $request->offset - $request->limit / 2);
|
$offset = max(0, $offset - $request->limit / 2);
|
||||||
} else {
|
} else {
|
||||||
$start = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->posts->findWhere(
|
return $this->posts->findWhere(
|
||||||
|
@ -20,7 +20,7 @@ trait GetsPosts
|
||||||
$user,
|
$user,
|
||||||
$request->sort,
|
$request->sort,
|
||||||
$request->limit,
|
$request->limit,
|
||||||
$request->offset
|
$offset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user