Removed the concept of silencing.

Nothing really implemented it properly or checked for it and the places that did check just handled it as a slightly softer ban.
It's pretty obvious that the existence of this feature was directly taken from osu! where the differentation between a ban and a silence probably makes more sense, though even there Silences are just non-permanent bans, so like why does this exist lol?
Well, it doesn't anymore! Hopefully chat will upgrade successfully because I let it get 18 commits behind :D
This commit is contained in:
flash 2023-07-23 21:47:15 +00:00
parent 3d67b59238
commit ee304af133
13 changed files with 11 additions and 39 deletions

View file

@ -11,10 +11,6 @@
--accent-colour: #666;
}
.profile__warning--silence {
--accent-colour: #f70;
}
.profile__warning--ban {
--accent-colour: #c33;
}
@ -136,4 +132,4 @@
.profile__warning__options {
justify-content: flex-start;
}
}
}

View file

@ -28,10 +28,6 @@ if($currentUserInfo->isBanned()) {
echo render_info('You have been banned, check your profile for more information.', 403);
return;
}
if($currentUserInfo->isSilenced()) {
echo render_info('You have been silenced, check your profile for more information.', 403);
return;
}
$comments = $msz->getComments();

View file

@ -22,10 +22,6 @@ if(isset($currentUser) && $currentUser->isBanned()) {
echo render_info('You have been banned, check your profile for more information.', 403);
return;
}
if(isset($currentUser) && $currentUser->isSilenced()) {
echo render_info('You have been silenced, check your profile for more information.', 403);
return;
}
$postInfo = forum_post_get($postId, true);
$perms = empty($postInfo)

View file

@ -87,10 +87,6 @@ if(in_array($moderationMode, $validModerationModes, true)) {
echo render_info('You have been banned, check your profile for more information.', 403);
return;
}
if($topicUser->isSilenced()) {
echo render_info('You have been silenced, check your profile for more information.', 403);
return;
}
switch($moderationMode) {
case 'delete':

View file

@ -154,7 +154,6 @@ Template::render('manage.users.warnings', [
'types' => [
UserWarning::TYPE_NOTE => 'Note',
UserWarning::TYPE_WARN => 'Warning',
UserWarning::TYPE_MUTE => 'Silence',
UserWarning::TYPE_BAHN => 'Ban',
],
],

View file

@ -6,7 +6,7 @@ use Misuzu\Users\User;
final class SharpChatPerms {
private const P_KICK_USER = 0x00000001;
private const P_BAN_USER = 0x00000002;
private const P_SILENCE_USER = 0x00000004;
//private const P_SILENCE_USER = 0x00000004;
private const P_BROADCAST = 0x00000008;
private const P_SET_OWN_NICK = 0x00000010;
private const P_SET_OTHER_NICK = 0x00000020;
@ -26,7 +26,7 @@ final class SharpChatPerms {
private const PERMS_DEFAULT = self::P_SEND_MESSAGE | self::P_DELETE_OWN_MSG | self::P_EDIT_OWN_MSG;
private const PERMS_MANAGE_USERS = self::P_SET_OWN_NICK | self::P_SET_OTHER_NICK | self::P_DELETE_ANY_MSG
| self::P_EDIT_ANY_MSG | self::P_VIEW_IP_ADDR | self::P_BROADCAST;
private const PERMS_MANAGE_WARNS = self::P_KICK_USER | self::P_BAN_USER | self::P_SILENCE_USER;
private const PERMS_MANAGE_WARNS = self::P_KICK_USER | self::P_BAN_USER;
private const PERMS_CHANGE_BACKG = self::P_SET_OWN_NICK | self::P_CREATE_CHANNEL | self::P_SET_CHAN_PASS;
private const PERMS_MANAGE_FORUM = self::P_CREATE_CHANNEL | self::P_SET_CHAN_PERMA | self::P_SET_CHAN_PASS
| self::P_SET_CHAN_HIER | self::P_DELETE_CHANNEL | self::P_JOIN_ANY_CHAN;

View file

@ -234,7 +234,6 @@ final class SharpChatRoutes {
'colour_raw' => Colour::toMisuzu($userInfo->getColour()),
'rank' => $rank = $userInfo->getRank(),
'hierarchy' => $rank,
'is_silenced' => date('c', $userInfo->isSilenced() || $userInfo->isBanned() ? ($userInfo->isActiveWarningPermanent() ? strtotime('10 years') : $userInfo->getActiveWarningExpiration()) : 0),
'perms' => SharpChatPerms::convert($userInfo),
];
}

View file

@ -497,9 +497,6 @@ class User implements HasRankInterface {
public function hasActiveWarning(): bool {
return $this->getActiveWarning() !== null && !$this->getActiveWarning()->hasExpired();
}
public function isSilenced(): bool {
return $this->hasActiveWarning() && $this->getActiveWarning()->isSilence();
}
public function isBanned(): bool {
return $this->hasActiveWarning() && $this->getActiveWarning()->isBan();
}

View file

@ -13,20 +13,17 @@ class UserWarning {
// Warning, only shows up to moderators and the user themselves
public const TYPE_WARN = 1;
// Silences, prevent a user from speaking and is visible to any logged in user
public const TYPE_MUTE = 2;
// Banning, prevents a user from interacting in general
// User will still be able to log in and change certain details but can no longer partake in community things
public const TYPE_BAHN = 3;
private const TYPES = [self::TYPE_NOTE, self::TYPE_WARN, self::TYPE_MUTE, self::TYPE_BAHN];
private const TYPES = [self::TYPE_NOTE, self::TYPE_WARN, self::TYPE_BAHN];
private const VISIBLE_TO_STAFF = self::TYPES;
private const VISIBLE_TO_USER = [self::TYPE_WARN, self::TYPE_MUTE, self::TYPE_BAHN];
private const VISIBLE_TO_PUBLIC = [self::TYPE_MUTE, self::TYPE_BAHN];
private const VISIBLE_TO_USER = [self::TYPE_WARN, self::TYPE_BAHN];
private const VISIBLE_TO_PUBLIC = [self::TYPE_BAHN];
private const HAS_DURATION = [self::TYPE_MUTE, self::TYPE_BAHN];
private const HAS_DURATION = [self::TYPE_BAHN];
private const PROFILE_BACKLOG = 90;
@ -132,7 +129,6 @@ class UserWarning {
public function getType(): int { return $this->warning_type; }
public function isNote(): bool { return $this->getType() === self::TYPE_NOTE; }
public function isWarning(): bool { return $this->getType() === self::TYPE_WARN; }
public function isSilence(): bool { return $this->getType() === self::TYPE_MUTE; }
public function isBan(): bool { return $this->getType() === self::TYPE_BAHN; }
public function isVisibleToUser(): bool {

View file

@ -194,7 +194,7 @@ function manage_perms_list(array $rawPerms): array {
],
[
'section' => 'manage-warnings',
'title' => 'Can manage warnings, silences and bans.',
'title' => 'Can manage bans, warnings and notes.',
'perm' => MSZ_PERM_USER_MANAGE_WARNINGS,
],
],

View file

@ -43,7 +43,7 @@
<div class="warning auth__warning">
<div class="warning__content">
{% if register_restricted == 'ban' %}
<p class="auth__warning__paragraph">A user is currently in a banned and/or silenced state from the same IP address you're currently visiting the site from. If said user isn't you and you wish to create an account, please <a href="{{ url('info', {'title': 'contact'}) }}" class="warning__link">contact us</a>!</p>
<p class="auth__warning__paragraph">A user from the same IP address you're currently visiting the site from is banned. If said user isn't you and you wish to create an account, please <a href="{{ url('info', {'title': 'contact'}) }}" class="warning__link">contact us</a>!</p>
{% else %}
<p class="auth__warning__paragraph">The IP address from which you are visiting the website appears on our blacklist, you are not allowed to register from this address but if you already have an account you can log in just fine using the form above. If you think this blacklisting is a mistake, please <a href="{{ url('info', {'title': 'contact'}) }}" class="warning__link">contact us</a>!</p>
{% endif %}

View file

@ -129,7 +129,7 @@
{% if current_user.hasActiveWarning|default(false) %}
<div class="warning">
<div class="warning__content">
You have been {{ current_user.isSilenced ? 'silenced' : 'banned' }} {% if current_user.isActiveWarningPermanent %}<strong>permanently</strong>{% else %}until <strong>{{ current_user.activeWarningExpiration|date('r') }}</strong>{% endif %}, view the account standing table on <a href="{{ url('user-account-standing', {'user': current_user.id}) }}" class="warning__link">your profile</a> to view why.
You have been banned {% if current_user.isActiveWarningPermanent %}<strong>permanently</strong>{% else %}until <strong>{{ current_user.activeWarningExpiration|date('r') }}</strong>{% endif %}, view the account standing table on <a href="{{ url('user-account-standing', {'user': current_user.id}) }}" class="warning__link">your profile</a> to view why.
</div>
</div>
{% endif %}

View file

@ -251,10 +251,7 @@
{% macro user_profile_warning(warning, show_private_note, show_user_info, delete_csrf) %}
{% from 'macros.twig' import avatar %}
{% if warning.isSilence %}
{% set warning_text = 'Silence' %}
{% set warning_class = 'silence' %}
{% elseif warning.isBan %}
{% if warning.isBan %}
{% set warning_text = 'Ban' %}
{% set warning_class = 'ban' %}
{% elseif warning.isWarning %}