-
Notifications
You must be signed in to change notification settings - Fork 284
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
Optimize getSharedWith to fetch permissions with initial query instead of one per card #6114
base: main
Are you sure you want to change the base?
Conversation
lib/Sharing/DeckShareProvider.php
Outdated
$share->setPermissions($this->permissionService->boardToFilePermission($shareToPermissionMap[$cardId])); | ||
return; | ||
} | ||
|
||
try { | ||
$this->permissionService->checkPermission($this->cardMapper, $share->getSharedWith(), Acl::PERMISSION_EDIT, $userId); |
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.
This is the previously expensive part as it needs to:
- find the board id for the card which we already have in the result of the query that fetches all shares
- fetches the permissions for each board (N+1) which can be optimized by only fetching once we have all board ids
- Then a map from card id to the related board permissions is built and passed along to the logic above to actually build the file permissions
@juliushaertl I think cypress/integration tests are failing. :) |
5930b64
to
8e57bcf
Compare
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
8e57bcf
to
cb469fb
Compare
Tests should pass now. |
🐢 Performance warning. |
🐢 Performance warning. |
Summary
TODO
Checklist