Update StatusService

This commit is contained in:
Daniel Supernault 2024-09-11 02:53:06 -06:00
parent 1da08feed0
commit 0539018f11
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -30,9 +30,9 @@ class StatusService
if (! $status) { if (! $status) {
return null; return null;
} }
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer()); $fractal->setSerializer(new ArraySerializer);
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer()); $resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer);
$res = $fractal->createData($resource)->toArray(); $res = $fractal->createData($resource)->toArray();
$res['_pid'] = isset($res['account']) && isset($res['account']['id']) ? $res['account']['id'] : null; $res['_pid'] = isset($res['account']) && isset($res['account']['id']) ? $res['account']['id'] : null;
if (isset($res['_pid'])) { if (isset($res['_pid'])) {
@ -112,7 +112,7 @@ class StatusService
{ {
$status = self::get($id, false); $status = self::get($id, false);
if (! $status) { if (! $status || ! $pid) {
return [ return [
'liked' => false, 'liked' => false,
'shared' => false, 'shared' => false,
@ -146,9 +146,9 @@ class StatusService
return null; return null;
} }
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer()); $fractal->setSerializer(new ArraySerializer);
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer()); $resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer);
return $fractal->createData($resource)->toArray(); return $fractal->createData($resource)->toArray();
} }