diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-06-12 17:27:08 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-06-12 17:27:08 -0300 |
commit | 8426d04f1b8ac437835780e9ff1ce77a93724dd3 (patch) | |
tree | bc45420061dcce1877cd2ea2b8ff7521675d88aa /service/pixelated | |
parent | dce8d8c85662dfce403fef99d95af6b0d4a3045a (diff) |
[refactor] use flags property on mail
Use it instead of reapeating fdoc.content[flags]
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/model/mail.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py index 7c4223de..464e0343 100644 --- a/service/pixelated/adapter/model/mail.py +++ b/service/pixelated/adapter/model/mail.py @@ -393,6 +393,10 @@ class PixelatedMail(Mail): def uid(self): return self.fdoc.content['uid'] + @property + def flags(self): + return self.fdoc.content['flags'] + def save(self): return self.querier.save_mail(self) @@ -407,21 +411,21 @@ class PixelatedMail(Mail): return self.tags def mark_as_read(self): - if Status.SEEN in self.fdoc.content['flags']: + if Status.SEEN in self.flags: return self - self.fdoc.content['flags'].append(Status.SEEN) + self.flags.append(Status.SEEN) self.save() return self def mark_as_unread(self): - if Status.SEEN in self.fdoc.content['flags']: - self.fdoc.content['flags'].remove(Status.SEEN) + if Status.SEEN in self.flags: + self.flags.remove(Status.SEEN) self.save() return self def mark_as_not_recent(self): - if Status.RECENT in self.fdoc.content['flags']: - self.fdoc.content['flags'].remove(Status.RECENT) + if Status.RECENT in self.flags: + self.flags.remove(Status.RECENT) self.save() return self |