From 5ddad458d8816d13c029a5ea0c34ea59f6b966cf Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Mon, 8 Dec 2014 12:10:50 -0200 Subject: Tags are now saved and read from the flags doc (old tags will be gone from this commit on) --- service/pixelated/adapter/mail.py | 4 ++-- service/pixelated/adapter/soledad_querier.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py index e2a48062..96fd8038 100644 --- a/service/pixelated/adapter/mail.py +++ b/service/pixelated/adapter/mail.py @@ -262,7 +262,7 @@ class PixelatedMail(Mail): @property def tags(self): - _tags = self.hdoc.content['headers'].get('X-Tags', '[]') + _tags = self.fdoc.content.get('tags', '[]') return set(_tags) if type(_tags) is list or type(_tags) is set else set(json.loads(_tags)) @property @@ -314,7 +314,7 @@ class PixelatedMail(Mail): return self def _persist_mail_tags(self, current_tags): - self.hdoc.content['headers']['X-Tags'] = json.dumps(list(current_tags)) + self.fdoc.content['tags'] = json.dumps(list(current_tags)) self.save() def has_tag(self, tag): diff --git a/service/pixelated/adapter/soledad_querier.py b/service/pixelated/adapter/soledad_querier.py index a11ff7a3..d76ac59f 100644 --- a/service/pixelated/adapter/soledad_querier.py +++ b/service/pixelated/adapter/soledad_querier.py @@ -98,10 +98,8 @@ class SoledadQuerier: return [PixelatedMail.from_soledad(*raw_mail, soledad_querier=self) for raw_mail in fdocs_hdocs_bdocs_parts] def save_mail(self, mail): - # XXX update only what has to be updated self.soledad.put_doc(mail.fdoc) - self.soledad.put_doc(mail.hdoc) - self._update_index([mail.fdoc, mail.hdoc]) + self._update_index([mail.fdoc]) def create_mail(self, mail, mailbox_name): mbox = [m for m in self.soledad.get_from_index('by-type', 'mbox') if m.content['mbox'] == 'INBOX'][0] -- cgit v1.2.3