mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Simplify NCNv1 userStatus call
This commit is contained in:
parent
057d72c816
commit
27edcddc9b
1 changed files with 4 additions and 16 deletions
|
@ -651,24 +651,12 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
}
|
||||
|
||||
protected function userStatus(array $url, array $data): ResponseInterface {
|
||||
$data = Arsse::$user->propertiesGet(Arsse::$user->id, true);
|
||||
// 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 = [
|
||||
return new Response([
|
||||
'userId' => (string) Arsse::$user->id,
|
||||
'displayName' => (string) ($data['name'] ?? Arsse::$user->id),
|
||||
'displayName' => (string) Arsse::$user->id,
|
||||
'lastLoginTimestamp' => time(),
|
||||
'avatar' => $avatar,
|
||||
];
|
||||
return new Response($out);
|
||||
'avatar' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function cleanupBefore(array $url, array $data): ResponseInterface {
|
||||
|
|
Loading…
Reference in a new issue