Remove "thread" argument in iter_unread_messages
It is unused, and no backend implemented it — so it was wrong to have it in the function signature. It also does not seem very helpful, we have get_threads() if we want to do something advanced with treads. fixes #825
This commit is contained in:
parent
3279f5dc9c
commit
79724c90f5
8 changed files with 8 additions and 9 deletions
|
|
@ -240,7 +240,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
|
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
try:
|
try:
|
||||||
contacts = {}
|
contacts = {}
|
||||||
with self.browser:
|
with self.browser:
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ class BNPorcBackend(BaseBackend, ICapBank, ICapMessages):
|
||||||
thread = self.browser.get_thread(thread)
|
thread = self.browser.get_thread(thread)
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
threads = list(self.iter_threads(cache=True))
|
threads = list(self.iter_threads(cache=True))
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
if thread.root.flags & thread.root.IS_UNREAD:
|
if thread.root.flags & thread.root.IS_UNREAD:
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent):
|
||||||
for sub in com.comments:
|
for sub in com.comments:
|
||||||
self._insert_comment(sub, message, getseen)
|
self._insert_comment(sub, message, getseen)
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
for thread in self.iter_threads():
|
for thread in self.iter_threads():
|
||||||
self.fill_thread(thread, 'root', False)
|
self.fill_thread(thread, 'root', False)
|
||||||
for m in thread.iter_all_messages():
|
for m in thread.iter_all_messages():
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class HDSBackend(BaseBackend, ICapMessages):
|
||||||
|
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
for thread in self.iter_threads():
|
for thread in self.iter_threads():
|
||||||
if thread.id in self.storage.get('seen', default=[]):
|
if thread.id in self.storage.get('seen', default=[]):
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
for thread in self.iter_threads():
|
for thread in self.iter_threads():
|
||||||
for m in thread.iter_all_messages():
|
for m in thread.iter_all_messages():
|
||||||
if m.flags & m.IS_UNREAD:
|
if m.flags & m.IS_UNREAD:
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ class PhpBBBackend(BaseBackend, ICapMessages, ICapMessagesPost):
|
||||||
children=[],
|
children=[],
|
||||||
flags=Message.IS_HTML)
|
flags=Message.IS_HTML)
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
url = self.browser.get_root_feed_url()
|
url = self.browser.get_root_feed_url()
|
||||||
for article in Newsfeed(url, rssid).iter_entries():
|
for article in Newsfeed(url, rssid).iter_entries():
|
||||||
|
|
|
||||||
|
|
@ -140,11 +140,10 @@ class ICapMessages(IBaseCap):
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
"""
|
"""
|
||||||
Iterates on messages which hasn't been marked as read.
|
Iterates on messages which hasn't been marked as read.
|
||||||
|
|
||||||
@param thread thread name (optional)
|
|
||||||
@return [iter] Message objects
|
@return [iter] Message objects
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
|
||||||
t = self.get_thread(thread)
|
t = self.get_thread(thread)
|
||||||
return t or thread
|
return t or thread
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self):
|
||||||
for thread in self.iter_threads():
|
for thread in self.iter_threads():
|
||||||
if thread.id in self.storage.get('seen', default={}):
|
if thread.id in self.storage.get('seen', default={}):
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue