posts/index: fix rating:s being included in page title in safe mode.
Fixes bug described in d3e4ac7c17 (commitcomment-39049351)
When dealing with searches, there are several variables we have to keep
in mind:
* Whether tag aliases should be applied.
* Whether search terms should be sorted.
* Whether the rating:s and -status:deleted metatags should be added by
safe mode and the hide deleted posts setting.
Which of these things we need to do depends on the context:
* We want to apply aliases when actually doing the search, calculating
the count, looking up the wiki excerpt, recording missed/popular
searches in Reportbooru, and calculating related tags for the sidebar,
but not when displaying the raw search as typed by the user (for
example, in the page title or in the tag search box).
* We want to sort the search when calculating cache keys for fast_count
or related tags, and when recording missed/popular searches, but not
in the page title or when displaying the raw search.
* We want to add rating:s and -status:deleted when performing the
search, calculating the count, or recording missed/popular searches,
but not when calculating related tags for the sidebar, or when
displaying the page title or raw search.
Here we introduce normalized_query and try to use it in contexts where
query normalization is necessary. When to use the normalized query
versus the raw unnormalized query is still subtle and prone to error.
This commit is contained in:
@@ -305,6 +305,13 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select "#post_#{@post.id}", 1
|
||||
end
|
||||
end
|
||||
|
||||
context "in safe mode" do
|
||||
should "not include the rating:s tag in the page title" do
|
||||
get posts_path(tags: "1girl", safe_mode: true)
|
||||
assert_select "title", text: "1girl Art | Safebooru"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "show_seq action" do
|
||||
|
||||
Reference in New Issue
Block a user