posts: add is_taken_down flag.
Posts with the is_taken_down flag are "double-banned" and only visible to moderators.
This commit is contained in:
@@ -11,6 +11,7 @@ class Post < ApplicationRecord
|
|||||||
RESTRICTED_TAGS_REGEX = /(?:^| )(?:#{Danbooru.config.restricted_tags.join("|")})(?:$| )/o
|
RESTRICTED_TAGS_REGEX = /(?:^| )(?:#{Danbooru.config.restricted_tags.join("|")})(?:$| )/o
|
||||||
|
|
||||||
deletable
|
deletable
|
||||||
|
has_bit_flags %w[has_embedded_notes is_taken_down]
|
||||||
|
|
||||||
normalize :source, :normalize_source
|
normalize :source, :normalize_source
|
||||||
before_validation :merge_old_changes
|
before_validation :merge_old_changes
|
||||||
@@ -1509,8 +1510,6 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
has_bit_flags ["has_embedded_notes"]
|
|
||||||
|
|
||||||
def safeblocked?
|
def safeblocked?
|
||||||
CurrentUser.safe_mode? && (rating != "s" || Danbooru.config.safe_mode_restricted_tags.any? { |tag| tag.in?(tag_array) })
|
CurrentUser.safe_mode? && (rating != "s" || Danbooru.config.safe_mode_restricted_tags.any? { |tag| tag.in?(tag_array) })
|
||||||
end
|
end
|
||||||
@@ -1521,8 +1520,10 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def banblocked?(user = CurrentUser.user)
|
def banblocked?(user = CurrentUser.user)
|
||||||
return false unless is_banned?
|
return true if is_taken_down? && !user.is_moderator?
|
||||||
(has_tag?("paid_reward") && !user.is_approver?) || !user.is_gold?
|
return true if is_banned? && has_tag?("paid_reward") && !user.is_approver?
|
||||||
|
return true if is_banned? && !user.is_gold?
|
||||||
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def visible?(user = CurrentUser.user)
|
def visible?(user = CurrentUser.user)
|
||||||
|
|||||||
Reference in New Issue
Block a user