From 6079196a9237ff1ae77ffb2bbc66f8bdc8698711 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Fri, 12 Sep 2014 11:53:12 -0300 Subject: When adding draft, return the mail with the new draft id so the UI can update it later --- service/pixelated/adapter/mail_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'service/pixelated/adapter/mail_service.py') diff --git a/service/pixelated/adapter/mail_service.py b/service/pixelated/adapter/mail_service.py index 1183dae2..5f651187 100644 --- a/service/pixelated/adapter/mail_service.py +++ b/service/pixelated/adapter/mail_service.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . from pixelated.adapter.tag_service import TagService +from pixelated.support.id_gen import gen_pixelated_uid class MailService: @@ -33,7 +34,7 @@ class MailService: if query['tags']: _mails = self.mailboxes.mails_by_tag(query['tags']) - return sorted(_mails or [], key=lambda mail: mail.date, reverse=True) + return sorted(_mails or [], key=lambda mail: mail.headers['date'], reverse=True) def update_tags(self, mail_id, new_tags): mail = self.mail(mail_id) @@ -48,8 +49,7 @@ class MailService: self.mail_sender.sendmail(mail) def create_draft(self, mail): - drafts = self.mailboxes.drafts() - drafts.add(mail) + return self.mailboxes.add_draft(mail) def send_draft(self, mail): pass -- cgit v1.2.3