From a9626c697992fcd596726a4c16ba8c9757f6a0dd Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Fri, 12 Feb 2016 17:58:45 -0200 Subject: attachments are only un-linked from emails but not deleted in soledad - removed backend delete of attachments - JS unit tests - Functional test Issue #549 --- .../pixelated/adapter/mailstore/leap_attachment_store.py | 6 ------ service/pixelated/adapter/services/mail_service.py | 3 --- service/pixelated/resources/attachments_resource.py | 14 -------------- 3 files changed, 23 deletions(-) (limited to 'service/pixelated') diff --git a/service/pixelated/adapter/mailstore/leap_attachment_store.py b/service/pixelated/adapter/mailstore/leap_attachment_store.py index 2c004abf..982d9222 100644 --- a/service/pixelated/adapter/mailstore/leap_attachment_store.py +++ b/service/pixelated/adapter/mailstore/leap_attachment_store.py @@ -63,9 +63,3 @@ class LeapAttachmentStore(object): def _calc_attachment_id_(self, content, content_type, encoder=encoders.encode_base64): cdoc = self._attachment_to_cdoc(content, content_type, encoder) return cdoc.phash - - @defer.inlineCallbacks - def delete_attachment(self, attachment_id): - doc = yield self.soledad.get_from_index('by-type-and-payloadhash', 'cnt', attachment_id) - doc = doc[0] - yield self.soledad.delete_doc(doc) diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index d2506dcf..dd1a32d8 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -151,6 +151,3 @@ class MailService(object): @defer.inlineCallbacks def delete_permanent(self, mail_id): yield self.mail_store.delete_mail(mail_id) - - def delete_attachment(self, attachment_id): - return self.attachment_store.delete_attachment(attachment_id) diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py index da455f98..086f6e4e 100644 --- a/service/pixelated/resources/attachments_resource.py +++ b/service/pixelated/resources/attachments_resource.py @@ -72,20 +72,6 @@ class AttachmentResource(Resource): match = re.compile('([A-Za-z-]+\/[A-Za-z-]+)').search(content_type) return match.group(1) - def render_DELETE(self, request): - def success(_): - response_json = {"ident": self.attachment_id} - respond_json_deferred(response_json, request, status_code=200) - - def failure(err): - request.code = 500 - request.finish() - - d = self.mail_service.delete_attachment(self.attachment_id) - d.addCallback(success) - d.addErrback(failure) - return server.NOT_DONE_YET - class AttachmentsResource(BaseResource): BASE_URL = 'attachment' -- cgit v1.2.3