diff --git a/app/models/search/tag_query.rb b/app/models/search/tag_query.rb index 05e6bc9da69..f28463d19dc 100644 --- a/app/models/search/tag_query.rb +++ b/app/models/search/tag_query.rb @@ -89,6 +89,10 @@ def wrangling_status_filter { bool: { should: [exists_filter("merger_id"), term_filter(:canonical, true)] } } when "noncanonical_nonsynonymous" [{ bool: { must_not: exists_filter("merger_id") } }, term_filter(:canonical, false)] + when "unwrangleable" + term_filter(:unwrangleable, true) + when "noncanonical_nonsynonymous_not_unwrangleable" + [term_filter(:canonical, false), { bool: { must_not: exists_filter("merger_id") } }, term_filter(:unwrangleable, false)] end end diff --git a/app/views/tags/_search_form.html.erb b/app/views/tags/_search_form.html.erb index 5dcbea15941..50ce8a1c26d 100644 --- a/app/views/tags/_search_form.html.erb +++ b/app/views/tags/_search_form.html.erb @@ -59,6 +59,14 @@ <%= f.radio_button :wrangling_status, "noncanonical_nonsynonymous" %> <%= f.label :wrangling_status, t(".status_option.noncanonical_and_nonsynonymous"), value: "noncanonical_nonsynonymous" %> +
  • + <%= f.radio_button :wrangling_status, "noncanonical_nonsynonymous_not_unwrangleable" %> + <%= f.label :wrangling_status, t(".status_option.noncanonical_nonsynonymous_and_not_unwrangleable"), value: "noncanonical_nonsynonymous_not_unwrangleable" %> +
  • +
  • + <%= f.radio_button :wrangling_status, "unwrangleable" %> + <%= f.label :wrangling_status, t(".status_option.unwrangleable"), value: "unwrangleable" %> +
  • <%= f.radio_button :wrangling_status, "" %> <%= f.label :wrangling_status, t(".status_option.any_status"), value: "" %> diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index e4d4402806f..f133058fd5e 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -2634,7 +2634,9 @@ en: canonical_or_synonymous: Canonical or synonymous noncanonical: Non-canonical noncanonical_and_nonsynonymous: Non-canonical and non-synonymous + noncanonical_nonsynonymous_and_not_unwrangleable: Non-canonical and non-synonymous and not marked unwrangleable synonymous: Synonymous + unwrangleable: Unwrangleable tag_name: Tag name type: Type wrangling_status: Wrangling status diff --git a/features/tags_and_wrangling/tag_search.feature b/features/tags_and_wrangling/tag_search.feature index cbcbb63ce9f..048075895f1 100644 --- a/features/tags_and_wrangling/tag_search.feature +++ b/features/tags_and_wrangling/tag_search.feature @@ -150,6 +150,7 @@ Feature: Search Tags Scenario: Search by wrangling status Given a fandom exists with name: "Not Canon Fandom", canonical: false And a character exists with name: "Canon Character", canonical: true + And a freeform exists with name: "Not Canon Unwrangleable Tag", unwrangleable: true And a synonym "Same Canon Character" of the tag "Canon Character" And all indexing jobs have been run When I am on the search tags page @@ -160,14 +161,16 @@ Feature: Search Tags And I should not see the tag search result "Fandom: Not Canon Fandom (0)" And I should see the tag search result "Character: Canon Character (0)" And I should not see the tag search result "Character: Same Canon Character (0)" + And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" When I am on the search tags page And I fill in "Tag name" with "Canon" And I choose "Non-canonical" And I press "Search Tags" - Then I should see "2 Found" + Then I should see "3 Found" And I should see the tag search result "Fandom: Not Canon Fandom (0)" And I should not see the tag search result "Character: Canon Character (0)" And I should see the tag search result "Character: Same Canon Character (0)" + And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" When I am on the search tags page And I fill in "Tag name" with "Canon" And I choose "Synonymous" @@ -176,6 +179,7 @@ Feature: Search Tags And I should not see the tag search result "Fandom: Not Canon Fandom (0)" And I should not see the tag search result "Character: Canon Character (0)" And I should see the tag search result "Character: Same Canon Character (0)" + And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" When I am on the search tags page And I fill in "Tag name" with "Canon" And I choose "Canonical or synonymous" @@ -184,22 +188,43 @@ Feature: Search Tags And I should not see the tag search result "Fandom: Not Canon Fandom (0)" And I should see the tag search result "Character: Canon Character (0)" And I should see the tag search result "Character: Same Canon Character (0)" + And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" When I am on the search tags page And I fill in "Tag name" with "Canon" And I choose "Non-canonical and non-synonymous" And I press "Search Tags" + Then I should see "2 Found" + And I should see the tag search result "Fandom: Not Canon Fandom (0)" + And I should not see the tag search result "Character: Canon Character (0)" + And I should not see the tag search result "Character: Same Canon Character (0)" + And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" + When I am on the search tags page + And I fill in "Tag name" with "Canon" + And I choose "Unwrangleable" + And I press "Search Tags" + Then I should see "1 Found" + And I should not see the tag search result "Fandom: Not Canon Fandom (0)" + And I should not see the tag search result "Character: Canon Character (0)" + And I should not see the tag search result "Character: Same Canon Character (0)" + And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" + When I am on the search tags page + And I fill in "Tag name" with "Canon" + And I choose "Non-canonical and non-synonymous and not marked unwrangleable" + And I press "Search Tags" Then I should see "1 Found" And I should see the tag search result "Fandom: Not Canon Fandom (0)" And I should not see the tag search result "Character: Canon Character (0)" And I should not see the tag search result "Character: Same Canon Character (0)" + And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" When I am on the search tags page And I fill in "Tag name" with "Canon" And I choose "Any status" And I press "Search Tags" - Then I should see "3 Found" + Then I should see "4 Found" And I should see the tag search result "Fandom: Not Canon Fandom (0)" And I should see the tag search result "Character: Canon Character (0)" And I should see the tag search result "Character: Same Canon Character (0)" + And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)" Scenario: Search and sort by Date Created in descending and ascending order Given a freeform exists with name: "created first", created_at: "2008-01-01 20:00:00 Z" diff --git a/spec/models/search/tag_query_spec.rb b/spec/models/search/tag_query_spec.rb index 7740e658d69..dbfab94a114 100644 --- a/spec/models/search/tag_query_spec.rb +++ b/spec/models/search/tag_query_spec.rb @@ -234,7 +234,7 @@ end it "does not return unwrangleable tags" do - expect(results).not_to include(tags[:unwrangeable]) + expect(results).not_to include(tags[:unwrangleable]) end it "does not return wrangled tags" do