-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
refactor(trash): Port deletion code of Trashbin to node based API #54278
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
base: master
Are you sure you want to change the base?
Conversation
0291ef5 to
9114ebb
Compare
d0be8fd to
299859f
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
0e8f8b3 to
f5294e5
Compare
a044d76 to
541b45e
Compare
Instead of using a mix of View and Node based file system manipulation, use the 'new' node based API everywhere. Replace the hooks used in the admin_audit related to the deletion to new typed event that expose the deleted nodes. And remove old calculateSize to get the size of the deleted folder and instead rely on the Node::getSize information. Signed-off-by: Carl Schwan <[email protected]> Signed-off-by: Carl Schwan <[email protected]>
541b45e to
ac029d1
Compare
| $node->delete(); | ||
| self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); | ||
|
|
||
| $event = new Events\NodeDeletedEvent($node); |
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.
It’s not clear to me whether it’s okay to pass a Node object around after a call to its delete method.
An alternative would be to use a new NonExistingNode object.
But maybe it’s just fine to use the node, it’s just a thought.
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.
Using just the node is fine as long as the listener doesn't try to use copy, rename or similar on it.
Creating a NonExistingFolder would be a bit ugly as it does need private information from the existing node
Summary
Instead of using a mix of View and Node based file system manipulation, use the 'new' node based API everywhere.
Replace the hooks used in the admin_audit related to the deletion to new typed event that expose the deleted nodes.
And remove old calculateSize to get the size of the deleted folder and instead rely on the Node::getSize information.
Checklist