mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update HomeTimeline api
This commit is contained in:
parent
bef959f451
commit
e5454620e6
2 changed files with 16 additions and 4 deletions
|
@ -309,7 +309,7 @@ class PublicApiController extends Controller
|
|||
->limit($limit)
|
||||
->get()
|
||||
->map(function($s) use ($user) {
|
||||
$status = StatusService::get($s->id);
|
||||
$status = StatusService::getFull($s->id, $user->profile_id);
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
return $status;
|
||||
});
|
||||
|
@ -341,10 +341,15 @@ class PublicApiController extends Controller
|
|||
->whereLocal(true)
|
||||
->whereScope('public')
|
||||
->orderBy('id', 'desc')
|
||||
->simplePaginate($limit);
|
||||
->limit($limit)
|
||||
->get()
|
||||
->map(function($s) use ($user) {
|
||||
$status = StatusService::getFull($s->id, $user->profile_id);
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
return $status;
|
||||
});
|
||||
|
||||
$fractal = new Fractal\Resource\Collection($timeline, new StatusTransformer());
|
||||
$res = $this->fractal->createData($fractal)->toArray();
|
||||
$res = $timeline->toArray();
|
||||
}
|
||||
|
||||
return response()->json($res);
|
||||
|
|
|
@ -40,6 +40,13 @@ class StatusService {
|
|||
});
|
||||
}
|
||||
|
||||
public static function getFull($id, $pid, $publicOnly = true)
|
||||
{
|
||||
$res = self::get($id, $publicOnly);
|
||||
$res['relationship'] = RelationshipService::get($pid, $res['account']['id']);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function del($id)
|
||||
{
|
||||
$status = self::get($id);
|
||||
|
|
Loading…
Reference in a new issue