config: refactor restricted tag settings.
This commit is contained in:
@@ -1794,11 +1794,11 @@ class Post < ApplicationRecord
|
|||||||
has_bit_flags BOOLEAN_ATTRIBUTES
|
has_bit_flags BOOLEAN_ATTRIBUTES
|
||||||
|
|
||||||
def safeblocked?
|
def safeblocked?
|
||||||
CurrentUser.safe_mode? && (rating != "s" || has_tag?("toddlercon|toddler|diaper|tentacle|rape|bestiality|beastiality|lolita|loli|nude|shota|pussy|penis"))
|
CurrentUser.safe_mode? && (rating != "s" || Danbooru.config.safe_mode_restricted_tags.any? { |tag| tag.in?(tag_array) })
|
||||||
end
|
end
|
||||||
|
|
||||||
def levelblocked?
|
def levelblocked?
|
||||||
!Danbooru.config.can_user_see_post?(CurrentUser.user, self)
|
!CurrentUser.is_gold? && Danbooru.config.restricted_tags.any? { |tag| tag.in?(tag_array) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def banblocked?
|
def banblocked?
|
||||||
@@ -1806,10 +1806,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def visible?
|
def visible?
|
||||||
return false if safeblocked?
|
!safeblocked? && !levelblocked? && !banblocked?
|
||||||
return false if levelblocked?
|
|
||||||
return false if banblocked?
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload(options = nil)
|
def reload(options = nil)
|
||||||
|
|||||||
@@ -350,20 +350,14 @@ module Danbooru
|
|||||||
20
|
20
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_post_restricted?(post)
|
# Tags that are not visible in safe mode.
|
||||||
false
|
def safe_mode_restricted_tags
|
||||||
|
restricted_tags + %w[censored condom nipples nude penis pussy sexually_suggestive]
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_user_restricted?(user)
|
# Tags that are only visible to Gold+ users.
|
||||||
!user.is_gold?
|
def restricted_tags
|
||||||
end
|
[]
|
||||||
|
|
||||||
def can_user_see_post?(user, post)
|
|
||||||
if is_user_restricted?(user) && is_post_restricted?(post)
|
|
||||||
false
|
|
||||||
else
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_appeals_per_day
|
def max_appeals_per_day
|
||||||
|
|||||||
Reference in New Issue
Block a user