mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update AccountTransformer
This commit is contained in:
parent
e4669a8aab
commit
530149f0f4
2 changed files with 6 additions and 8 deletions
|
@ -102,19 +102,19 @@ class ApiV1Controller extends Controller
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
$id = $request->user()->id;
|
$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();
|
$profile = Profile::whereNull('status')->whereUserId($id)->firstOrFail();
|
||||||
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
|
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
$res['source'] = [
|
$res['source'] = [
|
||||||
'privacy' => $profile->is_private ? 'private' : 'public',
|
'privacy' => $profile->is_private ? 'private' : 'public',
|
||||||
'sensitive' => $profile->cw ? true : false,
|
'sensitive' => $profile->cw ? true : false,
|
||||||
'language' => 'en',
|
'language' => null,
|
||||||
'note' => '',
|
'note' => '',
|
||||||
'fields' => []
|
'fields' => []
|
||||||
];
|
];
|
||||||
return $res;
|
// return $res;
|
||||||
});
|
// });
|
||||||
|
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,10 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
'avatar_static' => $profile->avatarUrl(),
|
'avatar_static' => $profile->avatarUrl(),
|
||||||
'header' => '',
|
'header' => '',
|
||||||
'header_static' => '',
|
'header_static' => '',
|
||||||
'header_bg' => $profile->header_bg,
|
|
||||||
'emojis' => [],
|
'emojis' => [],
|
||||||
'moved' => null,
|
'moved' => null,
|
||||||
'fields' => [],
|
'fields' => null,
|
||||||
'bot' => false,
|
'bot' => null,
|
||||||
'website' => $profile->website,
|
|
||||||
'software' => 'pixelfed',
|
'software' => 'pixelfed',
|
||||||
'is_admin' => (bool) $is_admin,
|
'is_admin' => (bool) $is_admin,
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue