Repository navigation
Delete blockers indicating blocking resources without linking to them #4592
Description
Describe the bug
A clear and concise description of what the bug is.
Screen.Recording.2024-02-27.at.11.07.25.PM.mov
To Reproduce
- Go to https://fitznhmaoct2023-edge.test.specifysystems.org/specify/view/agent/2215/
- Log into the
NHMA Fresh waterCollection (aspetrifiedroadkill) - Wait for delete blockers to be fetched
- Observe behavior
- OS: macOs Sonoma 14.3
- Browser: Chrome
- Specify 7 Version: edge
- Database Name: Fitz_NHMA_Oct_2023
- Collection name: NHMA Fresh water
Developer Context
As indicated/implied in the video, this is a frontend issue: the backend endpoint to fetch delete blockers is properly returning the correct results.
More specifically, the Delete blocker query constructing by the frontend after fetching the delete blockers from the backend is returning an empty array when run (i..e, the rows variable in the Promise is an empty array in this case)
specify7/specifyweb/frontend/js_src/lib/components/Forms/DeleteButton.tsx
Lines 245 to 282 in 3118d6a
| ? createQuery( | |
| 'Delete blockers', | |
| directRelationship.table | |
| ).set('fields', [ | |
| QueryFieldSpec.fromPath(directRelationship.table.name, [ | |
| directRelationship.table.idField.name, | |
| ]) | |
| .toSpQueryField() | |
| .set('isDisplay', false) | |
| .set('operStart', queryFieldFilters.in.id) | |
| .set('startValue', ids.join(',')), | |
| /* | |
| * TODO: ParentRelationship.model.name should always be directRelationship.model.name. | |
| * Check if that can never be the case | |
| */ | |
| QueryFieldSpec.fromPath( | |
| parentRelationship.relatedTable.name, | |
| [ | |
| parentRelationship.name, | |
| parentRelationship.relatedTable.idField.name, | |
| ] | |
| ).toSpQueryField(), | |
| ]) | |
| : resolveParentViaOtherside( | |
| parentRelationship, | |
| directRelationship, | |
| resource.id | |
| ) | |
| ), | |
| { | |
| limit: 0, | |
| } | |
| ).then((rows) => | |
| rows.map(([direct, parent]) => ({ | |
| direct, | |
| parent, | |
| })) | |
| ), |
It was mentioned by @realVinayak that the problem is most likely related to the scoping of the CollectingEvent/CollectionObject records which are the parents of the Collector records.
The Delete blocker query likely scopes results to the currently logged in collection and thus would return no results if the records exist in a different scope then the currently logged in collection.
This can be partially confirmed by creating and running a query in the NHMA Fresh water collection on CollectionObject and filtering on CollectingEvent -> Collector -> ID, using one of the Collector IDs returned from the delete blocker endpoint
Activity
lexiclevenger commentedon Apr 23, 2024
I'm also running into this on KUPaleoBot_8_31_2023 with a delete blocker for a collection object associated with a loan:
melton-jason commentedon Jul 2, 2024
#5062 (comment)
emenslin commentedon Aug 6, 2024
Can recreate in edge (7.9.6)
emenslin commentedon Dec 26, 2024
Happening in ojsmnh with agent having a blocker for collector (same as first video)
eMT6HtiV0X.mp4