From e3bb06398cc22fdc24cdcbfe2c60cc66a0246edb Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 20 Mar 2012 16:49:37 +0100 Subject: [PATCH] bnporc: Force marking messages as read Because threads are in cache, the Message objects are not refreshed after set_message_read(). Also retrieve the "seen" storage only once per call. --- modules/bnporc/backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/bnporc/backend.py b/modules/bnporc/backend.py index 7c8a6700..4a0cec97 100644 --- a/modules/bnporc/backend.py +++ b/modules/bnporc/backend.py @@ -127,9 +127,12 @@ class BNPorcBackend(BaseBackend, ICapBank, ICapMessages): # the website is stupid and does not have the messages in the proper order threads = sorted(threads, key=lambda t: t.date, reverse=True) self._threads = threads + seen = self.storage.get('seen', default=[]) for thread in threads: - if thread.id not in self.storage.get('seen', default=[]): + if thread.id not in seen: thread.root.flags |= thread.root.IS_UNREAD + else: + thread.root.flags &= ~thread.root.IS_UNREAD yield thread def fill_thread(self, thread, fields=None):