Update AccountTransformer

This commit is contained in:
Daniel Supernault 2019-09-26 21:53:55 -06:00
parent e4669a8aab
commit 530149f0f4
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 6 additions and 8 deletions

View file

@ -102,19 +102,19 @@ class ApiV1Controller extends Controller
abort_if(!$request->user(), 403);
$id = $request->user()->id;
$res = Cache::remember('mastoapi:user:account:id:'.$id, now()->addHours(6), function() use($id) {
//$res = Cache::remember('mastoapi:user:account:id:'.$id, now()->addHours(6), function() use($id) {
$profile = Profile::whereNull('status')->whereUserId($id)->firstOrFail();
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray();
$res['source'] = [
'privacy' => $profile->is_private ? 'private' : 'public',
'sensitive' => $profile->cw ? true : false,
'language' => 'en',
'language' => null,
'note' => '',
'fields' => []
];
return $res;
});
// return $res;
// });
return response()->json($res);
}

View file

@ -29,12 +29,10 @@ class AccountTransformer extends Fractal\TransformerAbstract
'avatar_static' => $profile->avatarUrl(),
'header' => '',
'header_static' => '',
'header_bg' => $profile->header_bg,
'emojis' => [],
'moved' => null,
'fields' => [],
'bot' => false,
'website' => $profile->website,
'fields' => null,
'bot' => null,
'software' => 'pixelfed',
'is_admin' => (bool) $is_admin,
];