From 05c04979ed9be88503fee397d35b1d7822ce3c8f Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 4 Aug 2023 00:07:57 +0300 Subject: [PATCH] rename 2 modactions --- files/helpers/config/modaction_types.py | 6 +++--- files/routes/admin.py | 4 ++-- migrations/20230804-rename-2-modactions.sql | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 migrations/20230804-rename-2-modactions.sql diff --git a/files/helpers/config/modaction_types.py b/files/helpers/config/modaction_types.py index d04294a6c..8fa9b65f5 100644 --- a/files/helpers/config/modaction_types.py +++ b/files/helpers/config/modaction_types.py @@ -191,12 +191,12 @@ MODACTION_TYPES = { "icon": 'fa-user-crown', "color": 'bg-success' }, - 'mod_mute_user': { + 'mute_user': { "str": 'muted reports from {self.target_link}', "icon": 'fa-file-signature', "color": 'bg-danger' }, - 'mod_unmute_user': { + 'unmute_user': { "str": 'unmuted reports from {self.target_link}', "icon": 'fa-file-signature', "color": 'bg-success' @@ -412,7 +412,7 @@ MODACTION_TYPES = dict(sorted(MODACTION_TYPES.items())) MODACTION_PRIVILEGED_TYPES = { 'shadowban', 'unshadowban', - 'mod_mute_user', 'mod_unmute_user', + 'mute_user', 'unmute_user', 'link_accounts', 'delink_accounts', 'progstack_post', 'progstack_comment', 'unprogstack_post', 'unprogstack_comment' diff --git a/files/routes/admin.py b/files/routes/admin.py index 184753362..a37e6fa19 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1238,7 +1238,7 @@ def mute_user(v, user_id): if not user.is_muted: user.is_muted = True ma = ModAction( - kind='mod_mute_user', + kind='mute_user', user_id=v.id, target_user_id=user.id, ) @@ -1261,7 +1261,7 @@ def unmute_user(v, user_id): if user.is_muted: user.is_muted = False ma = ModAction( - kind='mod_unmute_user', + kind='unmute_user', user_id=v.id, target_user_id=user.id, ) diff --git a/migrations/20230804-rename-2-modactions.sql b/migrations/20230804-rename-2-modactions.sql new file mode 100644 index 000000000..25c362475 --- /dev/null +++ b/migrations/20230804-rename-2-modactions.sql @@ -0,0 +1,2 @@ +update modactions set kind='mute_user' where kind='mod_mute_user'; +update modactions set kind='unmute_user' where kind='mod_unmute_user';