mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 10:29:59 +00:00
Fix banned display on selection box
This commit is contained in:
parent
c9389cb888
commit
b51045503d
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue