Skip to content

perf: Skip doing a query just to check if a board is deleted#6893

Merged
juliusknorr merged 1 commit intomainfrom
perf/deck-share-deleted-cards
Apr 8, 2025
Merged

perf: Skip doing a query just to check if a board is deleted#6893
juliusknorr merged 1 commit intomainfrom
perf/deck-share-deleted-cards

Conversation

@juliusknorr
Copy link
Copy Markdown
Member

@juliusknorr juliusknorr commented Apr 8, 2025

Instead of doing one sql query to fetch the card details for each card that has an incoming file share we can just filter out deleted cards upfront and skip the check for it.

The extra query that is skipped is:

if (!$allowDeletedCard && $mapper instanceof CardMapper) {
try {
$card = $mapper->find((int)$id, false);
} catch (DoesNotExistException $e) {
throw new NoPermissionException('Permission denied');
}
if ($card->getDeletedAt() > 0) {
throw new NoPermissionException('Card is deleted');
}
}

Screenshot 2025-04-08 at 22 11 34

Steps to reproduce:

  • As userA create a deck board
  • create 12 cards with file attachments
  • share the board to userB with edit permissions
  • As userB send a propfind request to the root directory (or setup the file system in any way)

Signed-off-by: Julius Knorr <jus@bitgrid.net>
@juliusknorr

This comment has been minimized.

@juliusknorr juliusknorr merged commit aac11e9 into main Apr 8, 2025
37 checks passed
@juliusknorr juliusknorr deleted the perf/deck-share-deleted-cards branch April 8, 2025 20:59
@juliusknorr
Copy link
Copy Markdown
Member Author

/backport to stable31

@juliusknorr
Copy link
Copy Markdown
Member Author

/backport to stable30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants