diff --git a/src/Users/UsersRpcHandler.php b/src/Users/UsersRpcHandler.php index 6798b33..b3ca8be 100644 --- a/src/Users/UsersRpcHandler.php +++ b/src/Users/UsersRpcHandler.php @@ -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;