-
Notifications
You must be signed in to change notification settings - Fork 995
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
object @filter | ||
|
||
extends "api/v2/filters/main" | ||
|
||
node do |filter| | ||
partial("api/v2/taxonomies/children_nodes", :object => filter) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class RemoveTaxonomyAndOverrideFromFilter < ActiveRecord::Migration[7.0] | ||
def up | ||
# remove_column :filters, :override | ||
# filters = Filter.where(role_id: Role.where(origin: nil).or(Role.where(builtin: 2))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity: if we drop overriding anyway and force all the filters use inherited taxonomies, shouldn't we update all the filters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this selects only the editable filters There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Aren't they all editable?.. Also, since filters were taxonomable and we're removing this, we should probably also clean related leftovers, such as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the locked ones def locked?
return false if modify_locked || self.class.modify_locked
return false unless respond_to? :origin
origin.present? && builtin != BUILTIN_DEFAULT_ROLE
end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this is for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes but filters are a part of one role, and if its locked it cant be edited, not the role and not its filters, so it cant have override: true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My apologies, you're right. It a role is locked, the filters can't be overriden and we also don't allow to lock roles. I guess we could then search for overriden filters before we remove the column to update their taxonomy search to be based on the assigned role. And after that we could remove the column and the related taxonomy records. |
||
|
||
# filters.each do |filter| | ||
# filter.enforce_inherited_taxonomies | ||
# filter.update_column(:taxonomy_search, filter.taxonomy_search) | ||
# end | ||
end | ||
|
||
def down | ||
# add_column :filters, :taxonomy_search, :text | ||
# add_column :filters, :override, :boolean, :default => false, :null => false | ||
# 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 | ||
# filter.update_column(:taxonomy_search, filter.taxonomy_search) | ||
# end | ||
end | ||
end |
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.
IIUC, we don't make filters non-taxonomable, but rather force them to be in line with the role they're assigned to disabling user override possibility.If so, this should stay since this concern makes filter model taxonomable.I think by disabling possibility to override taxonomies on filter level, there is no longer need to have taxonomy association,
taxonomy_search
can be created on the fly duringbefore_save
.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.
isnt that what
before_save :enforce_inherited_taxonomies,
do?