Fix #4455: Two tag search gives option to create wiki page when one is a metatag.
This commit is contained in:
@@ -20,15 +20,15 @@
|
||||
<li class="active"><a href="#" id="show-posts-link">Posts</a></li>
|
||||
|
||||
<% if @post_set.artist.present? %>
|
||||
<li><%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %></li>
|
||||
<li class="artist-excerpt-link"><%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %></li>
|
||||
<% elsif @post_set.wiki_page.present? %>
|
||||
<li><%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %></li>
|
||||
<li class="wiki-excerpt-link"><%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %></li>
|
||||
<% elsif @post_set.pool.present? %>
|
||||
<li><%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %></li>
|
||||
<li class="pool-excerpt-link"><%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %></li>
|
||||
<% elsif @post_set.favgroup.present? %>
|
||||
<li><%= link_to "Favorite Group", favorite_group_path(@post_set.favgroup), :id => "show-excerpt-link" %></li>
|
||||
<li class="favgroup-excerpt-link"><%= link_to "Favorite Group", favorite_group_path(@post_set.favgroup), :id => "show-excerpt-link" %></li>
|
||||
<% elsif @post_set.has_blank_wiki? %>
|
||||
<li><%= link_to "Wiki", new_wiki_page_path(wiki_page: { title: @post_set.tag_string }), id: "show-excerpt-link" %></li>
|
||||
<li class="blank-wiki-excerpt-link"><%= link_to "Wiki", new_wiki_page_path(wiki_page: { title: @post_set.tag.name }), id: "show-excerpt-link" %></li>
|
||||
<% end %>
|
||||
|
||||
<li id="searchbox-redirect-link" class="mobile-only"><a href="#search-box">Search »</a></li>
|
||||
|
||||
@@ -58,11 +58,9 @@
|
||||
<%= link_to post_set.favgroup.pretty_name, favorite_group_path(post_set.favgroup) %>
|
||||
</h4>
|
||||
Creator: <%= link_to_user post_set.favgroup.creator %>
|
||||
<% else %>
|
||||
<% if post_set.tag_string.present? %>
|
||||
<p>There is currently no wiki page for the tag "<%= post_set.tag_string %>". You can <%= link_to "create one", new_wiki_page_path(:wiki_page => {:title => post_set.tag_string}) %>.</p>
|
||||
<% elsif post_set.has_blank_wiki? %>
|
||||
<p>There is currently no wiki page for the tag <%= link_to_wiki post_set.tag.pretty_name %>. You can <%= link_to "create one", new_wiki_page_path(wiki_page: { title: post_set.tag.name }) %>.</p>
|
||||
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: post_set.tag %>
|
||||
<% end %>
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: post_set.tag %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -102,7 +102,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "with a multi-tag search" do
|
||||
should "render" do
|
||||
as(create(:user)) do
|
||||
create(:post, tag_string: "1girl solo")
|
||||
create(:post, tag_string: "1girl solo", rating: "s")
|
||||
create(:wiki_page, title: "1girl")
|
||||
end
|
||||
|
||||
@@ -111,6 +111,23 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select "#show-excerpt-link", count: 0
|
||||
end
|
||||
|
||||
should "show the wiki excerpt if the search has a tag with a wiki" do
|
||||
as(@user) { create(:wiki_page, title: "1girl") }
|
||||
create(:post, tag_string: "1girl rating:s")
|
||||
get posts_path, params: { tags: "1girl rating:s" }
|
||||
|
||||
assert_response :success
|
||||
assert_select "li.wiki-excerpt-link", count: 1
|
||||
end
|
||||
|
||||
should "show the blank wiki excerpt if the search has tag without a wiki" do
|
||||
create(:post, tag_string: "1girl rating:s")
|
||||
get posts_path, params: { tags: "1girl rating:s" }
|
||||
|
||||
assert_response :success
|
||||
assert_select "li.blank-wiki-excerpt-link", count: 1
|
||||
end
|
||||
|
||||
should "render an error when searching for too many tags" do
|
||||
get posts_path, params: { tags: "1 2 3" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user