search: reduce queries in single tag searches (#4120).

Avoid some queries used in wiki page excerpts:

* Only try to load the artist if the tag is an artist tag.
* Avoid using `exists?` queries for wiki pages.
* Bugfix: don't show wiki excerpts for deleted wikis.
This commit is contained in:
evazion
2019-08-12 13:38:45 -05:00
parent bda69315ff
commit 14da425564
4 changed files with 11 additions and 31 deletions

View File

@@ -26,9 +26,9 @@
<menu id="post-sections">
<li class="active"><a href="#" id="show-posts-link">Posts</a></li>
<% if @post_set.has_artist? %>
<% if @post_set.artist.present? %>
<li><%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %></li>
<% elsif @post_set.has_wiki? %>
<% elsif @post_set.wiki_page.present? %>
<li><%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %></li>
<% elsif @post_set.has_pool? %>
<li><%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %></li>