Changed safe mode error message for Gold+ users

- Made explicit the error messages and their order
- Banned takes priority, then Gold+, then Safe
- Made the groups exclusive of each other
This commit is contained in:
BrokenEagle
2017-11-23 13:07:01 -08:00
parent 5f39a8b4b2
commit 839f0f653f
4 changed files with 39 additions and 11 deletions

View File

@@ -1761,11 +1761,22 @@ class Post < ApplicationRecord
)
has_bit_flags BOOLEAN_ATTRIBUTES
def safeblocked?
CurrentUser.safe_mode? && (rating != "s" || has_tag?("toddlercon|toddler|diaper|tentacle|rape|bestiality|beastiality|lolita|loli|nude|shota|pussy|penis"))
end
def levelblocked?
!Danbooru.config.can_user_see_post?(CurrentUser.user, self)
end
def banblocked?
is_banned? && !CurrentUser.is_gold?
end
def visible?
return false if !Danbooru.config.can_user_see_post?(CurrentUser.user, self)
return false if CurrentUser.safe_mode? && rating != "s"
return false if CurrentUser.safe_mode? && has_tag?("toddlercon|toddler|diaper|tentacle|rape|bestiality|beastiality|lolita|loli|nude|shota|pussy|penis")
return false if is_banned? && !CurrentUser.is_gold?
return false if safeblocked?
return false if levelblocked?
return false if banblocked?
return true
end