Added option to include e-mail address in user rpc call.

This commit is contained in:
flash 2024-11-21 19:37:04 +00:00
parent 174ceaa4e7
commit 242e70eabf

View file

@ -19,7 +19,7 @@ final class UsersRpcHandler implements RpcHandler {
) {}
#[RpcQuery('misuzu:users:getUser')]
public function queryGetUser(string $userId): array {
public function queryGetUser(string $userId, bool $includeEMailAddress = false): array {
try {
$userInfo = $this->usersCtx->getUserInfo($userId, Users::GET_USER_ID);
} catch(RuntimeException) {
@ -65,6 +65,9 @@ final class UsersRpcHandler implements RpcHandler {
'created_at' => $userInfo->getCreatedAt()->toIso8601ZuluString(),
];
if($includeEMailAddress)
$output['email'] = $userInfo->getEMailAddress();
if($userInfo->hasLastActive())
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();