artists: hide banned artist pages from anonymous users.

Hide banned artist pages from anonymous (logged out) users. Partial
revert of 6b066f2ca. Artists sometimes ask us to remove all their
information from the site, including their artist profile. It's easier
to hide their profile than to explain to Japanese artists that a) we're
under no obligation to remove their profile and b) we need to keep it to
maintain the ban on their content that they asked for.
This commit is contained in:
evazion
2020-05-29 11:15:12 -05:00
parent feeea6602c
commit 7a819b0060
3 changed files with 31 additions and 21 deletions

View File

@@ -11,6 +11,10 @@ class ArtistPolicy < ApplicationPolicy
unbanned?
end
def can_view_banned?
user.is_member?
end
def permitted_attributes
[:name, :other_names, :other_names_string, :group_name, :url_string, :is_deleted]
end

View File

@@ -5,26 +5,30 @@
<div id="a-show">
<h1>Artist: <%= link_to @artist.pretty_name, posts_path(tags: @artist.name), class: tag_class(@artist.tag) %></h1>
<% if @artist.wiki_page.present? %>
<div class="prose">
<%= format_text(@artist.wiki_page.body, :disable_mentions => true) %>
</div>
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
<% end %>
<%= yield %>
<% if @artist.tag.present? && @artist.tag.post_count > 0 %>
<div class="recent-posts">
<h2>Recent Posts <%= link_to "»", posts_path(tags: @artist.name) %></h2>
<%= render "posts/partials/common/inline_blacklist" %>
<div>
<%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %>
<% if @artist.is_banned? && !policy(@artist).can_view_banned? %>
<p>The artist requested removal of this page.</p>
<% else %>
<% if @artist.wiki_page.present? %>
<div class="prose">
<%= format_text(@artist.wiki_page.body, :disable_mentions => true) %>
</div>
</div>
<% end %>
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
<% end %>
<%= yield %>
<% if @artist.tag.present? && @artist.tag.post_count > 0 %>
<div class="recent-posts">
<h2>Recent Posts <%= link_to "»", posts_path(tags: @artist.name) %></h2>
<%= render "posts/partials/common/inline_blacklist" %>
<div>
<%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %>
</div>
</div>
<% end %>
<% end%>
</div>
</div>

View File

@@ -1,7 +1,9 @@
<%# post_set %>
<div id="excerpt" style="display: none;">
<% if post_set.artist.present? %>
<% if post_set.artist.present? && post_set.artist.is_banned? && !policy(post_set.artist).can_view_banned? %>
<p>The artist requested removal of this page.</p>
<% elsif post_set.artist.present? %>
<% post_set.artist.tap do |artist| %>
<% unless artist.wiki_page.blank? %>
<div class="prose">