-
Notifications
You must be signed in to change notification settings - Fork 38
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
Scope all front-end requests where needed #3304
Conversation
Make "domainFilter" parameter required in fetchCollection() to make it harder to forget to specify correct value for that parameter (it determines whether query is scoped). Added "domainFilter:true" everywhere where necessary Fixes #2292 You would notice that I added "domainFilter:false" in a lot of places that seem like then need scoping. Example: ```js fetchCollection('LoanPreparation', { isResolved: true, limit: DEFAULT_FETCH_LIMIT, preparation: preparation.get('id'), domainFilter: false, }) ``` This was done because the results would already be scoped correctly because a filter on preparation id was added. In this case, setting "domainFilter: true", won't make any difference, except that it adds more filters to the query thus has performance overhead
Triggered by 0b9a4d6 on branch refs/heads/issue-2292
I do see potential problems with that change, as items that were once visible will no longer be (and previously valid pick list values would be invalid as well). I'm not sure if this has a large scope, however, as it is not common to use pick-list items based on an entire table or field, but it might be worth asking Andy or Theresa. |
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.
@melton-jason could you please pick up this PR? Remaining things:
|
Triggered by a64ca2a on branch refs/heads/issue-2292
The problem here is that The backend already has handling for scoping Attachments when specify7/specifyweb/specify/filter_by_col.py Lines 18 to 25 in 05ffff3
While the changes in 05ffff3 are 'hacky', I think any generic solution on the frontend would be quite messy (if not impossible without hardcoding around the attachment case).
The collection preference can be added to the Remote Properties App Resource with the pattern: Judging by the previous code and that in production, the picklistitems would only be unscoped (domainfilter set to false) when the table that the picklist is based off of is one of:
See specify7/specifyweb/frontend/js_src/lib/components/PickLists/fetch.ts Lines 115 to 117 in 52176a4
This behavior has been preserved. |
specifyweb/frontend/js_src/lib/components/DataModel/collection.ts
Outdated
Show resolved
Hide resolved
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.
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.
Looks good! Could not reproduce the collection issue from earlier.
Fixes #2292
To test: