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

Bug: Api rule filters bug on multiselect relation fields #2930

Closed
GD-coding opened this issue Jul 17, 2023 · 2 comments
Closed

Bug: Api rule filters bug on multiselect relation fields #2930

GD-coding opened this issue Jul 17, 2023 · 2 comments

Comments

@GD-coding
Copy link

GD-coding commented Jul 17, 2023

There seems to be an issue with the multiselect :length operator when using it on relational fields. The below example is not working in my case.

@request.auth.admin = true || users:length = 0 || users.id ?= @request.auth.id

image

The code works when the user is an admin or is in the list of related fields, but the :length operator is not working when trying to check if the property is empty.

Version 16.9

Thank you for all of the hard work that you do on this project!

@GD-coding GD-coding changed the title Api rule filters bug on multiselect relation fields Bug: Api rule filters bug on multiselect relation fields Jul 17, 2023
@ganigeorgiev
Copy link
Member

I suspect that the users field was added at later stage when there were already records in the collections, right? If that's the case then it is possible that default inserted value would be empty ""string and not [] because we currently don't normalize the default/missing value for already inserted data.

I'll have a look at it sometime later today, but as a workaround, if your field doesn't have more than 1 user yet assigned to it, you can try to change the users field to "single" and then back to "multiple" to retrigger the field value normalization.

ganigeorgiev added a commit that referenced this issue Jul 17, 2023
…ple fields has the correct zero-default for already inserted records
@ganigeorgiev
Copy link
Member

Should be fixed in v0.16.10 release.

abdokhaire pushed a commit to abdokhaire/postgresbase that referenced this issue Aug 7, 2024
…ated multiple fields has the correct zero-default for already inserted records
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants