From de9c26359ed448d4ee4937fa0d241469a7d76cf1 Mon Sep 17 00:00:00 2001 From: Patrick Maia and Victor Shyba Date: Wed, 27 Aug 2014 21:01:19 +0000 Subject: #51 - workaround to bypass SoledadMailbox and read flags directly from soledad. For now, SoledadMailbox.getFlags always returns a fixed set --- service/pixelated/adapter/pixelated_mailbox.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'service/pixelated/adapter') diff --git a/service/pixelated/adapter/pixelated_mailbox.py b/service/pixelated/adapter/pixelated_mailbox.py index 7521de6e..280e67c7 100644 --- a/service/pixelated/adapter/pixelated_mailbox.py +++ b/service/pixelated/adapter/pixelated_mailbox.py @@ -41,11 +41,18 @@ class PixelatedMailbox: return PixelatedMail.from_leap_mail(message) def all_tags(self): - return Tag.from_flags(self.leap_mailbox.getFlags()) + return Tag.from_flags(self._getFlags()) + + def _getFlags(self): + # XXX Temporary workaround while getFlags from leap is disabled + mbox = self.leap_mailbox._get_mbox_doc() + if not mbox: + return self.leap_mailbox.getFlags() + return mbox.content.get(self.leap_mailbox.FLAGS_KEY, []) def update_tags(self, tags): new_flags = set(tag.to_flag() for tag in tags) - current_flags = set(self.leap_mailbox.getFlags()) + current_flags = set(self._getFlags()) flags = tuple(current_flags.union(new_flags)) self.leap_mailbox.setFlags(flags) -- cgit v1.2.3