1
0
Fork 0
forked from mirror/pixelfed

Update BaseApiController, add source to verify_credentials endpoint

This commit is contained in:
Daniel Supernault 2019-09-23 19:08:45 -06:00
parent a3404a20e1
commit 043b3b51dd
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -306,7 +306,15 @@ class BaseApiController extends Controller
$res = Cache::remember('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());
return $this->fractal->createData($resource)->toArray();
$res = $this->fractal->createData($resource)->toArray();
$res['source'] = [
'privacy' => $profile->is_private ? 'private' : 'public',
'sensitive' => $profile->cw ? true : false,
'language' => 'en',
'note' => '',
'fields' => []
];
return $res;
});
return response()->json($res);