diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 5f80fa52d..1cb76e358 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -452,7 +452,7 @@ def execute_antispam_post_check(title, v, url): ma = ModAction( user_id=AUTOJANNY_ID, target_post_id=post.id, - kind="ban_post", + kind="remove_post", _note="Spam" ) g.db.add(ma) @@ -512,7 +512,7 @@ def execute_antispam_comment_check(body, v): ma = ModAction( user_id=AUTOJANNY_ID, target_comment_id=comment.id, - kind="ban_comment", + kind="remove_comment", _note="Spam" ) g.db.add(ma) diff --git a/files/helpers/config/modaction_types.py b/files/helpers/config/modaction_types.py index d4be99a7d..366a5307b 100644 --- a/files/helpers/config/modaction_types.py +++ b/files/helpers/config/modaction_types.py @@ -21,7 +21,7 @@ MODACTION_TYPES = { "icon": 'fa-badge', "color": 'bg-danger' }, - 'ban_comment': { + 'remove_comment': { "str": 'removed {self.target_link}', "icon": 'fa-comment', "color": 'bg-danger' @@ -31,7 +31,7 @@ MODACTION_TYPES = { "icon": 'fa-globe', "color": 'bg-danger' }, - 'ban_post': { + 'remove_post': { "str": 'removed post {self.target_link}', "icon": 'fa-feather-alt', "color": 'bg-danger' @@ -341,7 +341,7 @@ MODACTION_TYPES = { "icon": 'fa-snooze', "color": 'bg-success' }, - 'unban_comment': { + 'approve_comment': { "str": 'reinstated {self.target_link}', "icon": 'fa-comment', "color": 'bg-success' @@ -351,7 +351,7 @@ MODACTION_TYPES = { "icon": 'fa-globe', "color": 'bg-success' }, - 'unban_post': { + 'approve_post': { "str": 'reinstated post {self.target_link}', "icon": 'fa-feather-alt', "color": 'bg-success' diff --git a/files/routes/admin.py b/files/routes/admin.py index bc3ee6d43..1c10437ae 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -237,10 +237,10 @@ def revert_actions(v, username): cutoff = int(time.time()) - 86400 - posts = [x[0] for x in g.db.query(ModAction.target_post_id).filter(ModAction.user_id == revertee.id, ModAction.created_utc > cutoff, ModAction.kind == 'ban_post')] + posts = [x[0] for x in g.db.query(ModAction.target_post_id).filter(ModAction.user_id == revertee.id, ModAction.created_utc > cutoff, ModAction.kind == 'remove_post')] posts = g.db.query(Post).filter(Post.id.in_(posts)).all() - comments = [x[0] for x in g.db.query(ModAction.target_comment_id).filter(ModAction.user_id == revertee.id, ModAction.created_utc > cutoff, ModAction.kind == 'ban_comment')] + comments = [x[0] for x in g.db.query(ModAction.target_comment_id).filter(ModAction.user_id == revertee.id, ModAction.created_utc > cutoff, ModAction.kind == 'remove_comment')] comments = g.db.query(Comment).filter(Comment.id.in_(comments)).all() for item in posts + comments: @@ -1403,7 +1403,7 @@ def remove_post(post_id, v): g.db.add(post) ma = ModAction( - kind="ban_post", + kind="remove_post", user_id=v.id, target_post_id=post.id, ) @@ -1431,7 +1431,7 @@ def approve_post(post_id, v): if post.is_banned: ma = ModAction( - kind="unban_post", + kind="approve_post", user_id=v.id, target_post_id=post.id, ) @@ -1614,7 +1614,7 @@ def remove_comment(c_id, v): comment.ban_reason = v.username g.db.add(comment) ma = ModAction( - kind="ban_comment", + kind="remove_comment", user_id=v.id, target_comment_id=comment.id, ) @@ -1641,7 +1641,7 @@ def approve_comment(c_id, v): if comment.is_banned: ma = ModAction( - kind="unban_comment", + kind="approve_comment", user_id=v.id, target_comment_id=comment.id, ) diff --git a/migrations/20240816-rename ban to remove.sql b/migrations/20240816-rename ban to remove.sql new file mode 100644 index 000000000..b205a9ae9 --- /dev/null +++ b/migrations/20240816-rename ban to remove.sql @@ -0,0 +1,4 @@ +update modactions set kind='remove_comment' where kind='ban_comment'; +update modactions set kind='approve_comment' where kind='unban_comment'; +update modactions set kind='remove_post' where kind='ban_post'; +update modactions set kind='approve_post' where kind='unban_post';