wiki pages: fix redirects to exact matches during search.

Change wiki page search to redirect to exact matches only when using the
quick search bar. Fixes searches sometimes unexpectedly redirecting when
doing a regular (non-quick) search that happens to return a single result.

Also remove the logic that tries to expand the search when no results
are found. This will eventually be replaced with a smarter "did you mean?"
search.
This commit is contained in:
evazion
2019-10-31 02:08:51 -05:00
parent 91fd5e1bff
commit a8fc2ba508
4 changed files with 12 additions and 14 deletions

View File

@@ -22,12 +22,14 @@ class WikiPagesControllerTest < ActionDispatch::IntegrationTest
should "list all wiki_pages (with search)" do
get wiki_pages_path, params: {:search => {:title => "abc"}}
assert_redirected_to(wiki_page_path(@wiki_page_abc))
assert_response :success
assert_select "tr td:first-child", text: "abc"
end
should "list wiki_pages without tags with order=post_count" do
get wiki_pages_path, params: {:search => {:title => "abc", :order => "post_count"}}
assert_redirected_to(wiki_page_path(@wiki_page_abc))
assert_response :success
assert_select "tr td:first-child", text: "abc"
end
end