summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2014-12-08 12:10:50 -0200
committerBruno Wagner <bwgpro@gmail.com>2014-12-08 12:10:50 -0200
commit5ddad458d8816d13c029a5ea0c34ea59f6b966cf (patch)
tree6679d43502b3b6142719e43a53ce4e88b6d031a9
parent3eb66f0f7016e2ce61fdaa570b71c8adedc37fca (diff)
Tags are now saved and read from the flags doc (old tags will be gone from this commit on)
-rw-r--r--service/pixelated/adapter/mail.py4
-rw-r--r--service/pixelated/adapter/soledad_querier.py4
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]