Skip to content

Conversation

@CarlSchwan
Copy link
Member

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

@CarlSchwan CarlSchwan added this to the Nextcloud 32 milestone Aug 6, 2025
@CarlSchwan CarlSchwan self-assigned this Aug 6, 2025
@CarlSchwan CarlSchwan requested a review from a team as a code owner August 6, 2025 13:30
@CarlSchwan CarlSchwan requested review from Altahrim, icewind1991 and leftybournes and removed request for a team August 6, 2025 13:30
@CarlSchwan CarlSchwan force-pushed the cleanup-legacy-trash branch from 0291ef5 to 9114ebb Compare August 6, 2025 13:32
@CarlSchwan CarlSchwan changed the title cleanup(trash): Port deletion code of Trashbin to node based API refactor(trash): Port deletion code of Trashbin to node based API Aug 6, 2025
@CarlSchwan CarlSchwan force-pushed the cleanup-legacy-trash branch 2 times, most recently from d0be8fd to 299859f Compare August 6, 2025 14:01
@CarlSchwan CarlSchwan added the 3. to review Waiting for reviews label Aug 6, 2025
@CarlSchwan CarlSchwan marked this pull request as draft August 7, 2025 07:13
@skjnldsv skjnldsv added the ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) label Aug 19, 2025
@github-actions
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

@CarlSchwan CarlSchwan force-pushed the cleanup-legacy-trash branch 2 times, most recently from 0e8f8b3 to f5294e5 Compare September 3, 2025 13:12
@CarlSchwan CarlSchwan marked this pull request as ready for review September 3, 2025 13:21
@susnux susnux added the pending documentation This pull request needs an associated documentation update label Sep 3, 2025
@CarlSchwan CarlSchwan force-pushed the cleanup-legacy-trash branch 2 times, most recently from a044d76 to 541b45e Compare September 3, 2025 14:55
@CarlSchwan CarlSchwan modified the milestones: Nextcloud 32, Nextcloud 33 Sep 3, 2025
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]>
@CarlSchwan CarlSchwan force-pushed the cleanup-legacy-trash branch from 541b45e to ac029d1 Compare October 6, 2025 14:07
$node->delete();
self::emitTrashbinPostDelete('/files_trashbin/files/' . $file);

$event = new Events\NodeDeletedEvent($node);
Copy link
Contributor

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.

Copy link
Member Author

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

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

Labels

3. to review Waiting for reviews feedback-requested pending documentation This pull request needs an associated documentation update ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants