1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 10:00:01 +00:00

Fix banned display on selection box

This commit is contained in:
mreweilk 2017-07-16 14:19:20 -04:00
parent c9389cb888
commit b51045503d
2 changed files with 8 additions and 2 deletions

View file

@ -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'

View file

@ -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