From 7a819b0060983294a746c207d8e181d8966d9828 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 29 May 2020 11:15:12 -0500 Subject: [PATCH] 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. --- app/policies/artist_policy.rb | 4 ++ app/views/artists/_show.html.erb | 44 ++++++++++--------- .../posts/partials/index/_excerpt.html.erb | 4 +- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/policies/artist_policy.rb b/app/policies/artist_policy.rb index 1cd5dc2f6..ae0851d38 100644 --- a/app/policies/artist_policy.rb +++ b/app/policies/artist_policy.rb @@ -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 diff --git a/app/views/artists/_show.html.erb b/app/views/artists/_show.html.erb index 46ba09d94..3e7a65bec 100644 --- a/app/views/artists/_show.html.erb +++ b/app/views/artists/_show.html.erb @@ -5,26 +5,30 @@

Artist: <%= link_to @artist.pretty_name, posts_path(tags: @artist.name), class: tag_class(@artist.tag) %>

- <% if @artist.wiki_page.present? %> -
- <%= format_text(@artist.wiki_page.body, :disable_mentions => true) %> -
- -

<%= link_to "View wiki page", @artist.wiki_page %>

- <% end %> - - <%= yield %> - - <% if @artist.tag.present? && @artist.tag.post_count > 0 %> -
-

Recent Posts <%= link_to "»", posts_path(tags: @artist.name) %>

- - <%= render "posts/partials/common/inline_blacklist" %> - -
- <%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %> + <% if @artist.is_banned? && !policy(@artist).can_view_banned? %> +

The artist requested removal of this page.

+ <% else %> + <% if @artist.wiki_page.present? %> +
+ <%= format_text(@artist.wiki_page.body, :disable_mentions => true) %>
-
- <% end %> + +

<%= link_to "View wiki page", @artist.wiki_page %>

+ <% end %> + + <%= yield %> + + <% if @artist.tag.present? && @artist.tag.post_count > 0 %> +
+

Recent Posts <%= link_to "»", posts_path(tags: @artist.name) %>

+ + <%= render "posts/partials/common/inline_blacklist" %> + +
+ <%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %> +
+
+ <% end %> + <% end%>
diff --git a/app/views/posts/partials/index/_excerpt.html.erb b/app/views/posts/partials/index/_excerpt.html.erb index 3ab975386..bda961e4b 100644 --- a/app/views/posts/partials/index/_excerpt.html.erb +++ b/app/views/posts/partials/index/_excerpt.html.erb @@ -1,7 +1,9 @@ <%# post_set %>