Rename banned artist to avoid posting

This commit is contained in:
Kira 2019-10-13 12:44:25 -07:00
parent 1271f05fc8
commit 1d68c438df
4 changed files with 9 additions and 9 deletions

View File

@ -413,12 +413,12 @@ class Artist < ApplicationRecord
def unban!
Post.transaction do
CurrentUser.without_safe_mode do
ti = TagImplication.where(:antecedent_name => name, :consequent_name => "banned_artist").first
ti = TagImplication.where(:antecedent_name => name, :consequent_name => "avoid_posting").first
ti.destroy if ti
begin
Post.tag_match(name).records.each do |post|
fixed_tags = post.tag_string.sub(/(?:\A| )banned_artist(?:\Z| )/, " ").strip
fixed_tags = post.tag_string.sub(/(?:\A| )avoid_posting(?:\Z| )/, " ").strip
post.update(:tag_string => fixed_tags)
end
rescue Post::SearchError
@ -435,8 +435,8 @@ class Artist < ApplicationRecord
Post.transaction do
CurrentUser.without_safe_mode do
# potential race condition but unlikely
unless TagImplication.where(:antecedent_name => name, :consequent_name => "banned_artist").exists?
tag_implication = TagImplication.create!(:antecedent_name => name, :consequent_name => "banned_artist", :skip_secondary_validations => true)
unless TagImplication.where(:antecedent_name => name, :consequent_name => "avoid_posting").exists?
tag_implication = TagImplication.create!(:antecedent_name => name, :consequent_name => "avoid_posting", :skip_secondary_validations => true)
tag_implication.approve!(approver: CurrentUser.user)
end

View File

@ -2,7 +2,7 @@
<menu>
<li><%= render "artists/quick_search" %></li>
<%= subnav_link_to "Listing", artists_path %>
<%= subnav_link_to "Banned", banned_artists_path %>
<%= subnav_link_to "Avoid Posting", banned_artists_path %>
<% if CurrentUser.is_member? %>
<%= subnav_link_to "New", new_artist_path %>
<% end %>

View File

@ -1,8 +1,8 @@
<div id="c-artists">
<div id="a-banned">
<h1>Banned Artists</h1>
<h1>Avoid Posting</h1>
<p>The following artists have requested they be removed from the site. Please do not upload any works from these artists. These artists all have implications pointing to the <code>banned_artist</code> tag.</p>
<p>The following artists have requested they be removed from the site. Please do not upload any works from these artists. These artists all have implications pointing to the <code>avoid_posting</code> tag.</p>
<ul>
<% @artists.each do |artist| %>
@ -15,5 +15,5 @@
<%= render "secondary_links" %>
<% content_for(:page_title) do %>
Banned Artists - <%= Danbooru.config.app_name %>
Avoid Posting - <%= Danbooru.config.app_name %>
<% end %>

View File

@ -9,7 +9,7 @@
none
<% else %>
<% if source.artists.any?(&:is_banned?) %>
<%= TagSetPresenter.new(["banned_artist"]).tag_list_html(name_only: true) %>
<%= TagSetPresenter.new(["avoid_posting"]).tag_list_html(name_only: true) %>
<% end %>
<% source.artists.each do |artist| %>