-
Notifications
You must be signed in to change notification settings - Fork 34
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
BelongsToMany non-pivot action shouldn't use PivotId
#5923
Comments
Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example) |
Well I found the root cause of the issue. It's because I'm chaining In case you want to reproduce this issue: here's a repo
|
Pivot ID should have priority when it is available, since we can target the specific IDs instead of just relying on related IDs. |
The behaviour changed between 4.26 and 4.27, without any mention in the changelog so it breaks apps on a minor change (which is unexpected, maybe keep this change for a 5.X version). |
This would break other applications as well. Pivot ID should always have priority when it is available. |
No because it was not the behavior until this release. What breaks applications now, is this unexpected and undocumented change. |
Sorry but this is the expected behaviour, we probably missing some dusk tests to cover this usage causing the issue to occur. If someone willing to create a reproducing repository to showcase what need to change I would be willing to take a look. |
A reproductable repo was already given in previous answer. If this is the intended behaviour it means Actions are broken on every relation using id as pivot, with a confusing error "you are not authorized..." and no way to fix this issue since the query created inside the action does not handle this correctly (it expects id to be used on the main Model, not the Pivot). The PHP code from |
@crynobone any feedback ? |
@crynobone just a followup ? |
Still under review. Will update the issue once a PR is in place. |
PivotId
I believe this issue should be fixed. Please post a new issue if the issue persists. |
Yes all good now. Thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
Selecting resources to run actions on in BelongsToMany field passes the ID field's pivotValue regardless if it's a pivot action or not.
I think this is due to that now in the
IndexConcerns.js
file sinceselectedResourceIds
returns thepivotValue
on the ID field.The request's
toSelectedResourceQuery
selects from related table with the pivot ids which returns 0 records and causes the action to return "Sorry! You are not authorized to perform this action."Detailed steps to reproduce the issue on a fresh Nova installation:
The text was updated successfully, but these errors were encountered: