diff options
-rw-r--r-- | service/pixelated/adapter/mail.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py index 6beac4c2..092b4970 100644 --- a/service/pixelated/adapter/mail.py +++ b/service/pixelated/adapter/mail.py @@ -319,23 +319,11 @@ class PixelatedMail(Mail): return self.hdoc.content["headers"].get("OpenPGP", None) is not None def as_dict(self): - return { - 'header': {k.lower(): v for k, v in self.headers.items()}, - 'ident': self.ident, - 'tags': list(self.tags), - 'status': list(self.status), - 'security_casing': self.security_casing, - 'body': self.body, - '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] + dict_mail = super(PixelatedMail, self).as_dict() + recipients = dict_mail['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 + dict_mail['header']['to'][0] = recipients + dict_mail['header']['subject'] = 'Re: %s' % dict_mail['header']['subject'] + return dict_mail |