Bug #16463
closed
with_taxonomy_scope returns all objects when no taxable ids available
Added by Daniel Lobato Garcia about 8 years ago.
Updated over 6 years ago.
Category:
Organizations and Locations
|
Description
Currently scoping by taxonomies is broken.
Before this commit: https://github.com/theforeman/foreman/commit/35ed04f95f14c934ffebc874e90a3a4a6684fe71
`scope = scope.where(:id => taxable_ids) if taxable_ids`
did STILL call `scope.where(:id => [])` when taxable_ids were not found.
That returns an empty scope, and is the appropriate thing to do if there are no taxable IDs.
However after the commit, `if taxable_ids.present?` will make scope return `1=1` for the case where there are no taxable IDs.
If there are some taxable IDs, it does the right thing and scopes the object properly. That use case works fine.
- Related to Bug #16389: Can't create taxable e.g. domain object if I'm in context of specific organization or location added
- Status changed from New to Assigned
- Translation missing: en.field_release set to 181
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3824 added
- Translation missing: en.field_release changed from 181 to 160
The introducing commit is not present in 1.12 so I think this should go to 1.13 where it's present. Feel free to reset if I'm mistaken.
The change introducing the bug is currently set for inclusion in 1.12.3, so just setting this the same. Should #16389 be changed?
At your will, both have to be introduced at the same time though. I'd prefer to introduce them both on 1.13 to play safe with 1.12.3
Yes, they need to be on the same release. I opted for the point release on the other because I felt it was a somewhat severe bug, though it has a reasonably easy workaround.
- Translation missing: en.field_release changed from 160 to 181
Ok, makes sense, moving this back to 1.12.3 because of severity. Sorry for the noise.
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Also available in: Atom
PDF