From ed5520b54a7885f446671440d6a8a7bd3e05ea0b Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Mon, 22 Sep 2014 10:49:25 -0300 Subject: PixelatedMailbox to call mail#mark_as_deleted on removing mail (feature envy removal) --- service/pixelated/adapter/pixelated_mail.py | 4 ++++ service/pixelated/adapter/pixelated_mailbox.py | 3 ++- service/pixelated/adapter/pixelated_mailboxes.py | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'service/pixelated/adapter') diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py index 29dbdaa3..4ec9a7cd 100644 --- a/service/pixelated/adapter/pixelated_mail.py +++ b/service/pixelated/adapter/pixelated_mail.py @@ -96,6 +96,10 @@ class PixelatedMail: return set(tags) return set(json.loads(tags)) + def mark_as_deleted(self): + self.remove_all_tags() + self.leap_mail.setFlags((Status.PixelatedStatus.DELETED,), 1) + def remove_all_tags(self): self.update_tags(set([])) diff --git a/service/pixelated/adapter/pixelated_mailbox.py b/service/pixelated/adapter/pixelated_mailbox.py index fc28c733..4d558ea3 100644 --- a/service/pixelated/adapter/pixelated_mailbox.py +++ b/service/pixelated/adapter/pixelated_mailbox.py @@ -71,7 +71,8 @@ class PixelatedMailbox: return self.leap_mailbox.messages.add_msg(raw) def remove(self, mail): - mail.leap_mail.setFlags((Status.PixelatedStatus.DELETED,), 1) + mail.mark_as_deleted() + self.leap_mailbox.expunge() @classmethod diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py index 850db9d9..ad88d438 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/pixelated_mailboxes.py @@ -43,7 +43,6 @@ class PixelatedMailBoxes(): return new_mail def move_to_trash(self, mail): - mail.remove_all_tags() origin_mailbox = mail.mailbox_name new_mail_id = self.trash().add(mail) -- cgit v1.2.3