summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/mail_service.py
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-09-12 11:53:12 -0300
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-15 11:54:32 -0300
commit6079196a9237ff1ae77ffb2bbc66f8bdc8698711 (patch)
tree26a105c1c220a290e3a0acb92277517d01c6d524 /service/pixelated/adapter/mail_service.py
parent03f7ece809492f8b3c295065a14833b78cbd58d8 (diff)
When adding draft, return the mail with the new draft id so the UI can update it later
Diffstat (limited to 'service/pixelated/adapter/mail_service.py')
-rw-r--r--service/pixelated/adapter/mail_service.py6
1 files changed, 3 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
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