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.
This commit is contained in:
parent
4a5456b152
commit
e3bb06398c
1 changed files with 4 additions and 1 deletions
|
|
@ -127,9 +127,12 @@ class BNPorcBackend(BaseBackend, ICapBank, ICapMessages):
|
||||||
# the website is stupid and does not have the messages in the proper order
|
# the website is stupid and does not have the messages in the proper order
|
||||||
threads = sorted(threads, key=lambda t: t.date, reverse=True)
|
threads = sorted(threads, key=lambda t: t.date, reverse=True)
|
||||||
self._threads = threads
|
self._threads = threads
|
||||||
|
seen = self.storage.get('seen', default=[])
|
||||||
for thread in threads:
|
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
|
thread.root.flags |= thread.root.IS_UNREAD
|
||||||
|
else:
|
||||||
|
thread.root.flags &= ~thread.root.IS_UNREAD
|
||||||
yield thread
|
yield thread
|
||||||
|
|
||||||
def fill_thread(self, thread, fields=None):
|
def fill_thread(self, thread, fields=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue