From ff6951ef583f6889928bead34b22896f3e5bdaa7 Mon Sep 17 00:00:00 2001 From: Karolina Przerwa Date: Fri, 3 Nov 2023 10:26:59 +0100 Subject: [PATCH] components: use teardown for draft cleanup --- .../services/records/components/base.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/invenio_drafts_resources/services/records/components/base.py b/invenio_drafts_resources/services/records/components/base.py index b2cca50..6a04cc8 100644 --- a/invenio_drafts_resources/services/records/components/base.py +++ b/invenio_drafts_resources/services/records/components/base.py @@ -191,9 +191,7 @@ def _purge_bucket_and_ovs(self, files): if files.bucket: if files.bucket.locked: files.unlock() - if files.enabled: - files.delete_all(softdelete_obj=False, remove_rf=True) - files.remove_bucket(force=True) + files.teardown(full=True) def _publish_new(self, identity, draft, record): """Action when publishing a new draft.""" @@ -213,7 +211,7 @@ def _publish_new(self, identity, draft, record): # Cleanup if draft_files.enabled: # Hard delete all draft file records but keep the object versions - draft_files.delete_all(remove_obj=False, remove_rf=True) + draft_files.teardown(full=False) draft_files.unset_bucket() def _publish_edit(self, identity, draft, record):