Minor improvements (#1273)

* Minor improvements

* Updated
This commit is contained in:
Roman Kelesidis 2023-12-27 01:26:35 +07:00 committed by GitHub
commit 70322d7b73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 17 deletions

View file

@ -1981,7 +1981,7 @@ function profile_url($data)
if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) {
$profile = '<a href="' . make_url(PROFILE_URL . $user_id) . '">' . $profile . '</a>';
if ((bool)getUserBanInfo($user_id)) {
if (getBanInfo((int)$user_id)) {
return '<s>' . $profile . '</s>';
}
}
@ -2178,10 +2178,10 @@ function user_birthday_icon($user_birthday, $user_id): string
/**
* Returns information about user ban
*
* @param int $userId
* @param int|null $userId
* @return array|null
*/
function getUserBanInfo(int $userId): ?array
function getBanInfo(int $userId = null): ?array
{
global $datastore;
@ -2191,5 +2191,9 @@ function getUserBanInfo(int $userId): ?array
$bans = $datastore->get('ban_list');
}
if (!isset($userId)) {
return $bans;
}
return $bans[$userId] ?? [];
}