Added simpler avatar URL field.
This commit is contained in:
parent
39be84fcc0
commit
b2301dde45
1 changed files with 16 additions and 13 deletions
|
@ -35,24 +35,12 @@ final class UsersRpcHandler implements RpcHandler {
|
||||||
$colourRaw = null;
|
$colourRaw = null;
|
||||||
$colourCSS = (string)$colour;
|
$colourCSS = (string)$colour;
|
||||||
} else {
|
} else {
|
||||||
// Index doesn't have a proper toRawRGB func???
|
$colourRaw = Colour::toRawRgb($colour);
|
||||||
$colourRaw = Colour::toMisuzu($colour) & 0xFFFFFF;
|
|
||||||
$colourCSS = (string)ColourRgb::convert($colour);
|
$colourCSS = (string)ColourRgb::convert($colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUrl = $this->siteInfo->getURL();
|
$baseUrl = $this->siteInfo->getURL();
|
||||||
|
|
||||||
$avatars = [];
|
|
||||||
$formatAvatarUrl = fn($res = 0) => (
|
|
||||||
$baseUrl . $this->urls->format('user-avatar', ['user' => $userInfo->getId(), 'res' => $res])
|
|
||||||
);
|
|
||||||
|
|
||||||
$avatars[] = ['res' => 0, 'url' => $formatAvatarUrl()];
|
|
||||||
foreach(UserAvatarAsset::DIMENSIONS as $res)
|
|
||||||
$avatars[] = ['res' => $res, 'url' => $formatAvatarUrl($res)];
|
|
||||||
|
|
||||||
$avatars = array_reverse($avatars);
|
|
||||||
|
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
$output['id'] = $userInfo->getId();
|
$output['id'] = $userInfo->getId();
|
||||||
|
@ -83,7 +71,22 @@ final class UsersRpcHandler implements RpcHandler {
|
||||||
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
|
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
|
||||||
|
|
||||||
$output['profile_url'] = $baseUrl . $this->urls->format('user-profile', ['user' => $userInfo->getId()]);
|
$output['profile_url'] = $baseUrl . $this->urls->format('user-profile', ['user' => $userInfo->getId()]);
|
||||||
|
$output['avatar_url'] = $baseUrl . $this->urls->format('user-avatar', ['user' => $userInfo->getId()]);
|
||||||
|
|
||||||
|
/* Remove the following later */
|
||||||
|
$avatars = [];
|
||||||
|
$formatAvatarUrl = fn($res = 0) => (
|
||||||
|
$baseUrl . $this->urls->format('user-avatar', ['user' => $userInfo->getId(), 'res' => $res])
|
||||||
|
);
|
||||||
|
|
||||||
|
$avatars[] = ['res' => 0, 'url' => $formatAvatarUrl()];
|
||||||
|
foreach(UserAvatarAsset::DIMENSIONS as $res)
|
||||||
|
$avatars[] = ['res' => $res, 'url' => $formatAvatarUrl($res)];
|
||||||
|
|
||||||
|
$avatars = array_reverse($avatars);
|
||||||
|
|
||||||
$output['avatar_urls'] = $avatars;
|
$output['avatar_urls'] = $avatars;
|
||||||
|
/* / */
|
||||||
|
|
||||||
if($userInfo->isDeleted())
|
if($userInfo->isDeleted())
|
||||||
$output['is_deleted'] = true;
|
$output['is_deleted'] = true;
|
||||||
|
|
Reference in a new issue