diff --git a/invenio_curations/requests/curation.py b/invenio_curations/requests/curation.py index 777c166..c673f07 100644 --- a/invenio_curations/requests/curation.py +++ b/invenio_curations/requests/curation.py @@ -123,7 +123,18 @@ class CurationCancelAction(actions.CancelAction): """Cancel a request.""" # A user might want to cancel their request. - status_from = ["submitted", "critiqued", "resubmitted"] + # Also done when a draft for an already published record is deleted/discarded + status_from = [ + "accepted", + "cancelled", + "created", + "critiqued", + "declined", + "expired", + "resubmitted", + "review", + "submitted", + ] class CurationExpireAction(actions.ExpireAction): @@ -136,6 +147,8 @@ class CurationDeleteAction(actions.DeleteAction): """Delete a request.""" # When a user deletes their draft, the request will get deleted. Should be possible from every state. + # Usually delete is only possible programmatically, as the base permissions allow user driven deletion + # only during `created` status status_from = [ "accepted", "cancelled", @@ -147,7 +160,6 @@ class CurationDeleteAction(actions.DeleteAction): "review", "submitted", ] - status_to = "deleted" class CurationReviewAction(actions.RequestAction): diff --git a/invenio_curations/services/components.py b/invenio_curations/services/components.py index c9041e0..4eb943e 100644 --- a/invenio_curations/services/components.py +++ b/invenio_curations/services/components.py @@ -68,7 +68,7 @@ def delete_draft(self, identity, draft=None, record=None, force=False): # Delete draft for a published record. # Since only one request per record should exist, it is not deleted. Instead, put it back to accepted. current_requests_service.execute_action( - system_identity, request["id"], "accept" + system_identity, request["id"], "cancel" ) def update_draft(self, identity, data=None, record=None, errors=None):