mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 13:49:59 +00:00
Clean up models.User.level helpers
This commit is contained in:
parent
95d2bff614
commit
752a5a1f95
|
@ -68,8 +68,8 @@ def handle_torrent_upload(upload_form, uploading_user=None, fromAPI=False):
|
|||
torrent.remake = upload_form.is_remake.data
|
||||
torrent.complete = upload_form.is_complete.data
|
||||
# Copy trusted status from user if possible
|
||||
torrent.trusted = (uploading_user.level >=
|
||||
models.UserLevelType.TRUSTED) if uploading_user else False
|
||||
can_mark_trusted = uploading_user and uploading_user.is_trusted
|
||||
torrent.trusted = upload_form.is_trusted.data if can_mark_trusted else False
|
||||
# Set category ids
|
||||
torrent.main_category_id, torrent.sub_category_id = \
|
||||
upload_form.category.parsed_data.get_category_ids()
|
||||
|
|
|
@ -382,15 +382,15 @@ class User(db.Model):
|
|||
|
||||
@property
|
||||
def is_admin(self):
|
||||
return self.level is UserLevelType.ADMIN or self.level is UserLevelType.SUPERADMIN
|
||||
return self.level >= UserLevelType.ADMIN
|
||||
|
||||
@property
|
||||
def is_superadmin(self):
|
||||
return self.level is UserLevelType.SUPERADMIN
|
||||
return self.level == UserLevelType.SUPERADMIN
|
||||
|
||||
@property
|
||||
def is_trusted(self):
|
||||
return self.level is UserLevelType.TRUSTED
|
||||
return self.level >= UserLevelType.TRUSTED
|
||||
|
||||
|
||||
# class Session(db.Model):
|
||||
|
|
Loading…
Reference in a new issue