-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fixes #37987 - Filters dont inherit taxonomy on creation #10370
base: develop
Are you sure you want to change the base?
Conversation
baf4134
to
f46f2a5
Compare
319787a
to
e2698dc
Compare
filters = Filter.where(role_id: Role.where(origin: nil).or(Role.where(builtin: 2))).where(override: false).where(taxonomy_search: nil) | ||
|
||
filters.each do |filter| | ||
filter.build_taxonomy_search_from_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter.build_taxonomy_search_from_ids | |
filter.build_taxonomy_search |
test/models/filter_test.rb
Outdated
location_test = FactoryBot.create(:location) | ||
f.role = FactoryBot.create(:role, :organizations => [organization_test], :locations => [location_test]) | ||
f.save | ||
assert_equal f.taxonomy_search(), "(organization_id ^ (#{organization_test.id})) and (location_id ^ (#{location_test.id}))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_equal f.taxonomy_search(), "(organization_id ^ (#{organization_test.id})) and (location_id ^ (#{location_test.id}))" | |
assert_equal f.taxonomy_search, "(organization_id ^ (#{organization_test.id})) and (location_id ^ (#{location_test.id}))" |
@@ -29,7 +29,7 @@ const NewFiltersFormPage = ({ location: { search }, history }) => { | |||
isNew | |||
roleName={roleName || ''} | |||
roleId={urlRoleId} | |||
data={{}} | |||
data={{ locations, organizations }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
data.organizations?.map(o => o.id) || []
mean it would always be []
since taxonomies weren't passed within data
before your patch?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new page, in the edit page we have data={response}
e2698dc
to
1579997
Compare
thanks @ofedoren, updated |
To test:
before the pr: no taxonomy_search in the DB, and the filter is marked as unlimited
Added a migration to regenerate the taxonomy_search field of all filters which have override set to false to make them honor the organizations and locations set on the role.
Added a ui block on the unlimited checkbox if there are taxonomies in place.
Fixed "build_taxonomy_search" as it relayed on
locations
, but on creation there are onlylocation_ids
. Before this pr the workaround would be to edit and submit the filter (with no changes) since on editlocations
are already populated