This commit is contained in:
Christoph Haas 2021-02-20 21:19:24 +01:00
parent 6542ffbc19
commit 443f898ffd

View file

@ -95,33 +95,33 @@ class Screenshot < ApplicationRecord
end end
# Returns true if the current user has administrative permissions # Returns true if the current user has administrative permissions
def can_admin? # def can_admin?
self.admin == 1 # self.admin == 1
end # end
# Returns true if the current user can upload screenshots without moderation # Returns true if the current user can upload screenshots without moderation
def can_upload_without_moderation? # def can_upload_without_moderation?
# Admins can upload without moderation # # Admins can upload without moderation
true if self.can_admin # true if self.can_admin
# Authenticated users with at least one approved screenshot # # Authenticated users with at least one approved screenshot
#true if self.screenshots.where(approved: true).count >= 1 # #true if self.screenshots.where(approved: true).count >= 1
# Other visitors require moderation # # Other visitors require moderation
false # false
end # end
# Returns true if the current user can delete screenshots # Returns true if the current user can delete screenshots
def can_delete? # def can_delete?
# Admins can delete screenshots # # Admins can delete screenshots
true if self.can_admin # true if self.can_admin
# Authenticated users with at least one approved screenshot # # Authenticated users with at least one approved screenshot
#true if self.screenshots.where(approved: true).count >= 1 # #true if self.screenshots.where(approved: true).count >= 1
# Other visitors require moderation # # Other visitors require moderation
false # false
end # end
# Return the part of the version up to the first - or + # Return the part of the version up to the first - or +
def upstream_version def upstream_version