Skip to content
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

Bug: delete-filter updates user-data to early #8

Open
Dominic-Marcelino opened this issue Mar 10, 2022 · 0 comments
Open

Bug: delete-filter updates user-data to early #8

Dominic-Marcelino opened this issue Mar 10, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Dominic-Marcelino
Copy link
Contributor

Dominic-Marcelino commented Mar 10, 2022

If a file should be deleted, the extension updates the data in the files.delete filter (before the action happens).
This is necessary because after deletion the filesize is not available anymore (obviously!)

Problematically the deletion can be prevented afterwards by another filter or database constraint. In this case the extension-data have been already updated in the user profile.

Steps to recreate

  • Add a collection with a relation to files, add a constraint to prevent the file deletion
  • Move over to files and try to delete the file
  • The deletion is blocked by the constraint
  • The profile was already updated falsely!

Possible solutions:

  1. Get the data in the files.delete filter but only update the userprofile in the action (after deletion)
  2. Run like this, but also store the last changes. In case the deletion does not succeed, revert them
  3. Open a PR to Directus to add the File-Object to the delete event (best solution!)
@Dominic-Marcelino Dominic-Marcelino added the bug Something isn't working label Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant