mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update ApiV1Controller, fix bookmarks endpoint
This commit is contained in:
parent
e4e7b5062a
commit
f0e648b7b8
1 changed files with 13 additions and 17 deletions
|
@ -2935,24 +2935,20 @@ class ApiV1Controller extends Controller
|
||||||
$dir = $min_id ? '>' : '<';
|
$dir = $min_id ? '>' : '<';
|
||||||
$id = $min_id ?? $max_id;
|
$id = $min_id ?? $max_id;
|
||||||
|
|
||||||
if($id) {
|
|
||||||
$bookmarks = Bookmark::whereProfileId($pid)
|
$bookmarks = Bookmark::whereProfileId($pid)
|
||||||
->where('status_id', $dir, $id)
|
->when($id, function($id, $query) use($dir) {
|
||||||
|
return $query->where('status_id', $dir, $id);
|
||||||
|
})
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->pluck('status_id');
|
->pluck('status_id')
|
||||||
} else {
|
->map(function($id) {
|
||||||
$bookmarks = Bookmark::whereProfileId($pid)
|
return \App\Services\StatusService::getMastodon($id);
|
||||||
->latest()
|
})
|
||||||
->limit($limit)
|
->filter()
|
||||||
->pluck('status_id');
|
->values()
|
||||||
}
|
->toArray();
|
||||||
|
|
||||||
$res = [];
|
return $this->json($bookmarks);
|
||||||
foreach($bookmarks as $id) {
|
|
||||||
$res[] = \App\Services\StatusService::getMastodon($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->json($res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue