Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6795 fix 500 error when excluding search param is invalid #4899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def index
flash_search_warnings(@works)

@facets = @works.facets
if @search.options[:excluded_tag_ids].present?
if @search.options[:excluded_tag_ids].present? && @facets
tags = Tag.where(id: @search.options[:excluded_tag_ids])
tags.each do |tag|
@facets[tag.class.to_s.underscore] ||= []
Expand Down
3 changes: 3 additions & 0 deletions features/search/filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Feature: Filters
When I press "Fandoms" within "dd.exclude"
Then the "Legend of Korra (1)" checkbox within "#exclude_fandom_tags" should not be checked
And the "Harry Potter (1)" checkbox within "#exclude_fandom_tags" should not be checked
When I fill in "work_search_query" with "bad~query!!!"
And I press "Sort and Filter"
Then I should see "Your search failed because of a syntax error"
Comment on lines +82 to +84
Copy link
Contributor

@Bilka2 Bilka2 Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs after the filters have been cleared, so this test passes even without the bug fix.

I think it would be good to make a separate scenario for the bad query with an excluded tag, this scenario is already pretty long.


@javascript
Scenario: Filter through a user's works with non-existent tags
Expand Down
Loading