Alter output of /v1/me if banned.
This commit is contained in:
parent
07c822c2d7
commit
51b6d29a39
1 changed files with 14 additions and 10 deletions
|
@ -48,7 +48,6 @@ final class UsersRpcHandler implements RpcHandler {
|
|||
|
||||
// TODO: there should be some kinda privacy controls for users
|
||||
|
||||
$rank = $this->usersCtx->getUserRank($userInfo);
|
||||
|
||||
$colour = $this->usersCtx->getUserColour($userInfo);
|
||||
if($colour->shouldInherit()) {
|
||||
|
@ -70,18 +69,23 @@ final class UsersRpcHandler implements RpcHandler {
|
|||
|
||||
$output['colour_raw'] = $colourRaw;
|
||||
$output['colour_css'] = $colourCSS;
|
||||
$output['rank'] = $rank;
|
||||
$output['country_code'] = $userInfo->countryCode;
|
||||
|
||||
$roles = XArray::select(
|
||||
$this->usersCtx->roles->getRoles(userInfo: $userInfo, hasString: true, orderByRank: true),
|
||||
fn($roleInfo) => $roleInfo->string,
|
||||
);
|
||||
if($this->usersCtx->hasActiveBan($userInfo)) {
|
||||
$output['rank'] = 0;
|
||||
$output['roles'] = ['x-banned'];
|
||||
} else {
|
||||
$roles = XArray::select(
|
||||
$this->usersCtx->roles->getRoles(userInfo: $userInfo, hasString: true, orderByRank: true),
|
||||
fn($roleInfo) => $roleInfo->string,
|
||||
);
|
||||
|
||||
if(!empty($roles))
|
||||
$output['roles'] = $roles;
|
||||
if($userInfo->super)
|
||||
$output['is_super'] = true;
|
||||
$output['rank'] = $this->usersCtx->getUserRank($userInfo);
|
||||
if(!empty($roles))
|
||||
$output['roles'] = $roles;
|
||||
if($userInfo->super)
|
||||
$output['is_super'] = true;
|
||||
}
|
||||
|
||||
if(!empty($userInfo->title))
|
||||
$output['title'] = $userInfo->title;
|
||||
|
|
Loading…
Reference in a new issue