diff --git a/nyaa/models.py b/nyaa/models.py index cd4ecb0..e05bc78 100644 --- a/nyaa/models.py +++ b/nyaa/models.py @@ -571,6 +571,10 @@ class User(db.Model): def is_trusted(self): return self.level >= UserLevelType.TRUSTED + @property + def is_banned(self): + return self.status == UserStatusType.BANNED + class AdminLogBase(DeclarativeHelperBase): __tablename_base__ = 'adminlog' diff --git a/nyaa/routes.py b/nyaa/routes.py index 2dd6b6f..a0d0ae7 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -338,7 +338,7 @@ def view_user(user_name): elif selection == 'moderator': user.level = models.UserLevelType.MODERATOR log = "[{}]({}) changed to moderator user".format(user_name, url) - elif selection == 'disabled': + elif selection == 'banned': user.status = models.UserStatusType.BANNED log = "[{}]({}) changed to banned user".format(user_name, url) @@ -969,13 +969,15 @@ def _create_user_class_choices(user): choices.append(('trusted', 'Trusted')) if flask.g.user.is_superadmin: choices.append(('moderator', 'Moderator')) - choices.append(('disabled', 'Disabled')) + choices.append(('banned', 'Banned')) if user: if user.is_moderator: default = 'moderator' elif user.is_trusted: default = 'trusted' + elif user.is_banned: + default = 'banned' return default, choices