mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-11 22:50:45 +00:00
Update StatusService, cast response to array
This commit is contained in:
parent
8e85728994
commit
0fbde91e87
3 changed files with 4 additions and 3 deletions
|
@ -133,6 +133,7 @@ class BaseApiController extends Controller
|
||||||
$statuses = $account->statuses()->getQuery();
|
$statuses = $account->statuses()->getQuery();
|
||||||
if($only_media == true) {
|
if($only_media == true) {
|
||||||
$statuses = $statuses
|
$statuses = $statuses
|
||||||
|
->whereIn('scope', ['public','unlisted'])
|
||||||
->whereHas('media')
|
->whereHas('media')
|
||||||
->whereNull('in_reply_to_id')
|
->whereNull('in_reply_to_id')
|
||||||
->whereNull('reblog_of_id');
|
->whereNull('reblog_of_id');
|
||||||
|
|
|
@ -33,7 +33,7 @@ class StatusController extends Controller
|
||||||
|
|
||||||
$status = Status::whereProfileId($user->id)
|
$status = Status::whereProfileId($user->id)
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereNotIn('visibility',['draft','direct'])
|
->whereIn('scope', ['public','unlisted'])
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
if($status->uri || $status->url) {
|
if($status->uri || $status->url) {
|
||||||
|
|
|
@ -17,12 +17,12 @@ class StatusService {
|
||||||
|
|
||||||
public static function get($id)
|
public static function get($id)
|
||||||
{
|
{
|
||||||
return json_decode(Redis::get(self::CACHE_KEY . $id) ?? self::coldGet($id));
|
return json_decode(Redis::get(self::CACHE_KEY . $id) ?? self::coldGet($id), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function coldGet($id)
|
public static function coldGet($id)
|
||||||
{
|
{
|
||||||
$status = Status::findOrFail($id);
|
$status = Status::whereScope('public')->findOrFail($id);
|
||||||
$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());
|
||||||
|
|
Loading…
Reference in a new issue