summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter
diff options
context:
space:
mode:
authorLisa Junger <ljunger@thoughtworks.com>2014-11-19 10:44:08 +0100
committerAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-03 15:48:49 -0200
commitf273d2abeefa0d77d306bcfab3135195afbc31c3 (patch)
treedb0864f7e413f3c51756ecf9f32cdf235c1f4a90 /service/pixelated/adapter
parent6c5e6a65ed543193f676f601741fb597dc48e5dd (diff)
added functionality for reply all to service.
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r--service/pixelated/adapter/mail.py10
-rw-r--r--service/pixelated/adapter/mail_service.py4
2 files changed, 14 insertions, 0 deletions
diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py
index 949daa9e..6beac4c2 100644
--- a/service/pixelated/adapter/mail.py
+++ b/service/pixelated/adapter/mail.py
@@ -329,3 +329,13 @@ class PixelatedMail(Mail):
'mailbox': self.mailbox_name.lower(),
'attachments': self.parts['attachments'] if self.parts else []
}
+
+ def to_reply_template(self):
+ template = self.as_dict()
+ recipients = template['header']['to'][0]
+ for recipient in recipients:
+ if recipient == InputMail.FROM_EMAIL_ADDRESS:
+ recipients.remove(recipient)
+ template['header']['to'][0] = recipients
+ template['header']['subject'] = 'Re: %s' % template['header']['subject']
+ return template
diff --git a/service/pixelated/adapter/mail_service.py b/service/pixelated/adapter/mail_service.py
index 6c093b6d..722b9a29 100644
--- a/service/pixelated/adapter/mail_service.py
+++ b/service/pixelated/adapter/mail_service.py
@@ -83,3 +83,7 @@ class MailService:
def drafts(self):
raise NotImplementedError()
+
+ def reply_all_template(self, mail_id):
+ mail = self.mail(mail_id)
+ return mail.to_reply_template()