diff --git a/app/views/artists/_show.html.erb b/app/views/artists/_show.html.erb index 5352fc333..8a00e1bf6 100644 --- a/app/views/artists/_show.html.erb +++ b/app/views/artists/_show.html.erb @@ -8,12 +8,14 @@ <% if @artist.is_banned? && !policy(@artist).can_view_banned? %>

The artist requested removal of this page.

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

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

+

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

+
<% end %> <%= yield %> diff --git a/app/views/wiki_pages/show.html.erb b/app/views/wiki_pages/show.html.erb index 9596e045b..bd3b0bd22 100644 --- a/app/views/wiki_pages/show.html.erb +++ b/app/views/wiki_pages/show.html.erb @@ -28,7 +28,7 @@ <%= format_text(@wiki_page.body) %> <% end %> - <% if @wiki_page.artist.present? && !@wiki_page.artist.is_deleted %> + <% if @wiki_page.artist.present? && !@wiki_page.artist.is_deleted? %>

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

<% end %> diff --git a/test/functional/artists_controller_test.rb b/test/functional/artists_controller_test.rb index 2b24f3cc7..2907aa2a9 100644 --- a/test/functional/artists_controller_test.rb +++ b/test/functional/artists_controller_test.rb @@ -54,6 +54,22 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest get artist_path(@artist.id) assert_response :success end + + should "show active wikis" do + as(@user) { create(:wiki_page, title: @artist.name) } + get artist_path(@artist.id) + + assert_response :success + assert_select ".artist-wiki", count: 1 + end + + should "not show deleted wikis" do + as(@user) { create(:wiki_page, title: @artist.name, is_deleted: true) } + get artist_path(@artist.id) + + assert_response :success + assert_select ".artist-wiki", count: 0 + end end context "new action" do