posts: add "general" rating; rename "safe" rating to "sensitive".
* Add "general" rating. * Rename "safe" rating to "sensitive". * Change safe mode to include both rating:s and rating:g. * Treat rating:safe as a synonym for rating:sensitive. * Link "howto:rate" in the post edit form.
This commit is contained in:
@@ -11,11 +11,18 @@ class Post < ApplicationRecord
|
||||
RESTRICTED_TAGS_REGEX = /(?:^| )(?:#{Danbooru.config.restricted_tags.join("|")})(?:$| )/o
|
||||
|
||||
RATINGS = {
|
||||
s: "Safe",
|
||||
g: "General",
|
||||
s: "Sensitive",
|
||||
q: "Questionable",
|
||||
e: "Explicit",
|
||||
}.with_indifferent_access
|
||||
|
||||
RATING_ALIASES = {
|
||||
safe: ["s"],
|
||||
nsfw: ["q", "e"],
|
||||
sfw: ["g", "s"],
|
||||
}.with_indifferent_access
|
||||
|
||||
deletable
|
||||
has_bit_flags %w[has_embedded_notes _unused_has_cropped is_taken_down]
|
||||
|
||||
@@ -1064,16 +1071,14 @@ class Post < ApplicationRecord
|
||||
where(has_children: true)
|
||||
when "child"
|
||||
where.not(parent: nil)
|
||||
when "sfw"
|
||||
where.not(rating: ["q", "e"])
|
||||
when "nsfw"
|
||||
where(rating: ["q", "e"])
|
||||
when *AutocompleteService::POST_STATUSES
|
||||
status_matches(value, current_user)
|
||||
when *MediaAsset::FILE_TYPES
|
||||
attribute_matches(value, :file_ext, :enum)
|
||||
when *Post::RATINGS.values.map(&:downcase)
|
||||
rating_matches(value)
|
||||
when *Post::RATING_ALIASES.keys
|
||||
where(rating: Post::RATING_ALIASES.fetch(value.downcase))
|
||||
else
|
||||
none
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user