diff options
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/pixelated_mail.py | 3 | ||||
-rw-r--r-- | service/pixelated/user_agent.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py index 95f417d2..4b207059 100644 --- a/service/pixelated/adapter/pixelated_mail.py +++ b/service/pixelated/adapter/pixelated_mail.py @@ -242,6 +242,9 @@ class PixelatedMail: def get_bcc(self): return self.headers['Bcc'] + def get_date(self): + return self.headers['Date'] + def remove_all_tags(self): self.update_tags(set([])) diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py index 1bab0281..d97d5905 100644 --- a/service/pixelated/user_agent.py +++ b/service/pixelated/user_agent.py @@ -37,6 +37,7 @@ from pixelated.adapter.soledad_querier import SoledadQuerier from pixelated.adapter.search import SearchEngine from pixelated.adapter.tag_service import TagService from pixelated.adapter.draft_service import DraftService +import dateutil.parser as dateparser static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "web-ui", "app")) @@ -97,6 +98,8 @@ def mails(): mail_ids = search_engine.search(request.args.get('q')) mails = mail_service.mails(mail_ids) + mails = sorted(mails, key=lambda mail: dateparser.parse(mail.get_date()), reverse=True) + response = { "stats": { "total": len(mails), |