From 27e3ca71f920083e8bf1599facc2cc4638f8efcf Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 23 Nov 2015 19:51:12 -0300 Subject: Return 422 if deletion failed This is needed for protecting against concurrent saves on drafts. --Issue #512 --- service/pixelated/adapter/mailstore/leap_mailstore.py | 2 ++ service/pixelated/adapter/mailstore/searchable_mailstore.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'service/pixelated/adapter/mailstore') diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index f59034b8..3bf27bbf 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -291,6 +291,8 @@ class LeapMailStore(MailStore): message = yield self._fetch_msg_from_soledad(mail_id) if message and message.get_wrapper().mdoc.doc_id: yield message.get_wrapper().delete(self.soledad) + defer.returnValue(True) + defer.returnValue(False) @defer.inlineCallbacks def get_mailbox_mail_ids(self, mailbox_name): diff --git a/service/pixelated/adapter/mailstore/searchable_mailstore.py b/service/pixelated/adapter/mailstore/searchable_mailstore.py index 0c5310eb..07e99ba7 100644 --- a/service/pixelated/adapter/mailstore/searchable_mailstore.py +++ b/service/pixelated/adapter/mailstore/searchable_mailstore.py @@ -39,8 +39,9 @@ class SearchableMailStore(object): # implementes MailStore @defer.inlineCallbacks def delete_mail(self, mail_id): - yield self._delegate.delete_mail(mail_id) + removed = yield self._delegate.delete_mail(mail_id) self._search_engine.remove_from_index(mail_id) + defer.returnValue(removed) @defer.inlineCallbacks def update_mail(self, mail): -- cgit v1.2.3