mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Update ApiV1Controller, fix include_reblogs param on timelines/home endpoint, and improve limit pagination logic
This commit is contained in:
parent
175203089b
commit
287f903bf3
1 changed files with 3535 additions and 3534 deletions
|
@ -2146,7 +2146,7 @@ class ApiV1Controller extends Controller
|
|||
$max = $request->input('max_id');
|
||||
$limit = $request->input('limit') ?? 20;
|
||||
$pid = $request->user()->profile_id;
|
||||
$includeReblogs = $request->filled('include_reblogs');
|
||||
$includeReblogs = $request->filled('include_reblogs') ? $request->boolean('include_reblogs') : false;
|
||||
$nullFields = $includeReblogs ?
|
||||
['in_reply_to_id'] :
|
||||
['in_reply_to_id', 'reblog_of_id'];
|
||||
|
@ -2155,14 +2155,15 @@ class ApiV1Controller extends Controller
|
|||
['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'];
|
||||
|
||||
if(config('exp.cached_home_timeline')) {
|
||||
$paddedLimit = $includeReblogs ? $limit + 10 : $limit + 50;
|
||||
if($min || $max) {
|
||||
if($request->has('min_id')) {
|
||||
$res = HomeTimelineService::getRankedMinId($pid, $min ?? 0, $limit + 10);
|
||||
$res = HomeTimelineService::getRankedMinId($pid, $min ?? 0, $paddedLimit);
|
||||
} else {
|
||||
$res = HomeTimelineService::getRankedMaxId($pid, $max ?? 0, $limit + 10);
|
||||
$res = HomeTimelineService::getRankedMaxId($pid, $max ?? 0, $paddedLimit);
|
||||
}
|
||||
} else {
|
||||
$res = HomeTimelineService::get($pid, 0, $limit + 10);
|
||||
$res = HomeTimelineService::get($pid, 0, $paddedLimit);
|
||||
}
|
||||
|
||||
if(!$res) {
|
||||
|
|
Loading…
Reference in a new issue