Users: add Contributor and Approver user levels

This commit is contained in:
nonamethanks
2022-10-21 14:59:15 +02:00
parent f092bc28ee
commit ca31e7a47c
29 changed files with 105 additions and 251 deletions

View File

@@ -39,7 +39,7 @@ class UploadLimit
# @return [Boolean] true if the user can't upload because they're out of upload slots.
def limited?
!user.can_upload_free? && used_upload_slots >= upload_slots
!user.is_contributor? && used_upload_slots >= upload_slots
end
# @return [Boolean] true if the user is at max level.
@@ -91,7 +91,7 @@ class UploadLimit
# @param is_approval [Boolean] true if the post is being approved or
# undeleted, false if the post is being deleted.
def update_limit!(is_pending, is_approval)
return if user.can_upload_free?
return if user.is_contributor?
user.with_lock do
# If we're approving or deleting a pending post, we can simply increment