1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00

Simplify NCNv1 userStatus call

This commit is contained in:
J. King 2018-10-28 13:59:09 -04:00
parent 057d72c816
commit 27edcddc9b

View file

@ -651,24 +651,12 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
} }
protected function userStatus(array $url, array $data): ResponseInterface { protected function userStatus(array $url, array $data): ResponseInterface {
$data = Arsse::$user->propertiesGet(Arsse::$user->id, true); return new Response([
// construct the avatar structure, if an image is available
if (isset($data['avatar'])) {
$avatar = [
'data' => base64_encode($data['avatar']['data']),
'mime' => (string) $data['avatar']['type'],
];
} else {
$avatar = null;
}
// construct the rest of the structure
$out = [
'userId' => (string) Arsse::$user->id, 'userId' => (string) Arsse::$user->id,
'displayName' => (string) ($data['name'] ?? Arsse::$user->id), 'displayName' => (string) Arsse::$user->id,
'lastLoginTimestamp' => time(), 'lastLoginTimestamp' => time(),
'avatar' => $avatar, 'avatar' => null,
]; ]);
return new Response($out);
} }
protected function cleanupBefore(array $url, array $data): ResponseInterface { protected function cleanupBefore(array $url, array $data): ResponseInterface {