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:
evazion
2022-05-22 12:08:46 -05:00
parent d346adabc9
commit 81bd86d202
11 changed files with 62 additions and 25 deletions

View File

@@ -63,7 +63,7 @@ class DiscordSlashCommand
end
def is_censored?
(post.rating != "s" && !is_nsfw_channel?) || !post.visible?(User.anonymous) || censored_tags.any? { |tag| tag.in?(post.tag_array) }
(post.rating.in?(["q", "e"]) && !is_nsfw_channel?) || !post.visible?(User.anonymous) || censored_tags.any? { |tag| tag.in?(post.tag_array) }
end
def is_nsfw_channel?

View File

@@ -42,13 +42,13 @@ class DiscordSlashCommand
return nil if tag.nil? || tag.empty?
if tag.artist?
search = "#{tag.name} rating:safe"
search = "#{tag.name} is:sfw"
elsif tag.copyright?
search = "#{tag.name} rating:safe everyone copytags:<5 -parody -crossover"
search = "#{tag.name} is:sfw everyone copytags:<5 -parody -crossover"
elsif tag.character?
search = "#{tag.name} rating:safe solo chartags:<5"
search = "#{tag.name} is:sfw solo chartags:<5"
else # meta or general
search = "#{tag.name} rating:safe -animated -6+girls -comic"
search = "#{tag.name} is:sfw -animated -6+girls -comic"
end
Post.system_tag_match(search).limit(500).sort_by(&:score).last