From 8c523387515f56c480f5ea88f01ac71547901349 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 23 Jul 2023 21:47:15 +0000 Subject: [PATCH] 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 --- assets/misuzu.css/profile/warning.css | 6 +----- public-legacy/comments.php | 4 ---- public-legacy/forum/post.php | 4 ---- public-legacy/forum/topic.php | 4 ---- public-legacy/manage/users/warnings.php | 1 - src/SharpChat/SharpChatPerms.php | 4 ++-- src/SharpChat/SharpChatRoutes.php | 1 - src/Users/User.php | 3 --- src/Users/UserWarning.php | 12 ++++-------- src/manage.php | 2 +- templates/auth/register.twig | 2 +- templates/master.twig | 2 +- templates/user/macros.twig | 5 +---- 13 files changed, 11 insertions(+), 39 deletions(-) diff --git a/assets/misuzu.css/profile/warning.css b/assets/misuzu.css/profile/warning.css index bed75fc7..ad35b654 100644 --- a/assets/misuzu.css/profile/warning.css +++ b/assets/misuzu.css/profile/warning.css @@ -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; } -} \ No newline at end of file +} diff --git a/public-legacy/comments.php b/public-legacy/comments.php index b2d9047b..d9f465a8 100644 --- a/public-legacy/comments.php +++ b/public-legacy/comments.php @@ -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(); diff --git a/public-legacy/forum/post.php b/public-legacy/forum/post.php index 0d9f197d..ab236f34 100644 --- a/public-legacy/forum/post.php +++ b/public-legacy/forum/post.php @@ -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) diff --git a/public-legacy/forum/topic.php b/public-legacy/forum/topic.php index 98c856cb..f512b579 100644 --- a/public-legacy/forum/topic.php +++ b/public-legacy/forum/topic.php @@ -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': diff --git a/public-legacy/manage/users/warnings.php b/public-legacy/manage/users/warnings.php index d9ee50fc..abf4558f 100644 --- a/public-legacy/manage/users/warnings.php +++ b/public-legacy/manage/users/warnings.php @@ -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', ], ], diff --git a/src/SharpChat/SharpChatPerms.php b/src/SharpChat/SharpChatPerms.php index c72c7f14..7879642f 100644 --- a/src/SharpChat/SharpChatPerms.php +++ b/src/SharpChat/SharpChatPerms.php @@ -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; diff --git a/src/SharpChat/SharpChatRoutes.php b/src/SharpChat/SharpChatRoutes.php index ca005018..cc743408 100644 --- a/src/SharpChat/SharpChatRoutes.php +++ b/src/SharpChat/SharpChatRoutes.php @@ -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), ]; } diff --git a/src/Users/User.php b/src/Users/User.php index 34be6913..b165e62c 100644 --- a/src/Users/User.php +++ b/src/Users/User.php @@ -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(); } diff --git a/src/Users/UserWarning.php b/src/Users/UserWarning.php index 5dd4167f..4965ffa7 100644 --- a/src/Users/UserWarning.php +++ b/src/Users/UserWarning.php @@ -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 { diff --git a/src/manage.php b/src/manage.php index 0a2bff8d..35257d13 100644 --- a/src/manage.php +++ b/src/manage.php @@ -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, ], ], diff --git a/templates/auth/register.twig b/templates/auth/register.twig index c7d1fb80..b99717de 100644 --- a/templates/auth/register.twig +++ b/templates/auth/register.twig @@ -43,7 +43,7 @@
{% if register_restricted == 'ban' %} -

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 contact us!

+

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 contact us!

{% else %}

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 contact us!

{% endif %} diff --git a/templates/master.twig b/templates/master.twig index 6fc5cf53..db292c16 100644 --- a/templates/master.twig +++ b/templates/master.twig @@ -129,7 +129,7 @@ {% if current_user.hasActiveWarning|default(false) %}
- You have been {{ current_user.isSilenced ? 'silenced' : 'banned' }} {% if current_user.isActiveWarningPermanent %}permanently{% else %}until {{ current_user.activeWarningExpiration|date('r') }}{% endif %}, view the account standing table on your profile to view why. + You have been banned {% if current_user.isActiveWarningPermanent %}permanently{% else %}until {{ current_user.activeWarningExpiration|date('r') }}{% endif %}, view the account standing table on your profile to view why.
{% endif %} diff --git a/templates/user/macros.twig b/templates/user/macros.twig index 0340bbf1..a715de84 100644 --- a/templates/user/macros.twig +++ b/templates/user/macros.twig @@ -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 %}