add url to posts in signatures
This commit is contained in:
parent
1d057b400a
commit
c397bc0171
1 changed files with 25 additions and 29 deletions
|
|
@ -99,21 +99,10 @@ class PhpBBBackend(BaseBackend, ICapMessages):
|
||||||
thread = Thread(thread_id)
|
thread = Thread(thread_id)
|
||||||
thread.title = post.title
|
thread.title = post.title
|
||||||
|
|
||||||
flags = Message.IS_HTML
|
m = self._post2message(thread, post)
|
||||||
|
m.parent = parent
|
||||||
if last_seen_id < post.id:
|
if last_seen_id < post.id:
|
||||||
flags |= Message.IS_UNREAD
|
m.flags |= Message.IS_UNREAD
|
||||||
|
|
||||||
m = Message(thread=thread,
|
|
||||||
id=post.id,
|
|
||||||
title=post.title,
|
|
||||||
sender=post.author,
|
|
||||||
receivers=None,
|
|
||||||
date=post.date,
|
|
||||||
parent=parent,
|
|
||||||
content=post.content,
|
|
||||||
signature=post.signature,
|
|
||||||
children=[],
|
|
||||||
flags=flags)
|
|
||||||
|
|
||||||
if parent:
|
if parent:
|
||||||
parent.children = [m]
|
parent.children = [m]
|
||||||
|
|
@ -124,6 +113,23 @@ class PhpBBBackend(BaseBackend, ICapMessages):
|
||||||
|
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
|
def _post2message(self, thread, post):
|
||||||
|
signature = post.signature
|
||||||
|
if signature:
|
||||||
|
signature += '<br />'
|
||||||
|
signature += 'URL: %s' % id2url('%s.%s' % (thread.id, post.id))
|
||||||
|
return Message(thread=thread,
|
||||||
|
id=post.id,
|
||||||
|
title=post.title,
|
||||||
|
sender=post.author,
|
||||||
|
receivers=None,
|
||||||
|
date=post.date,
|
||||||
|
parent=None,
|
||||||
|
content=post.content,
|
||||||
|
signature=signature,
|
||||||
|
children=[],
|
||||||
|
flags=Message.IS_HTML)
|
||||||
|
|
||||||
def iter_unread_messages(self, thread=None):
|
def iter_unread_messages(self, thread=None):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
url = self.browser.get_root_feed_url()
|
url = self.browser.get_root_feed_url()
|
||||||
|
|
@ -142,17 +148,8 @@ class PhpBBBackend(BaseBackend, ICapMessages):
|
||||||
if self.config['thread_unread_messages'].get() > 0:
|
if self.config['thread_unread_messages'].get() > 0:
|
||||||
iterator = limit(iterator, self.config['thread_unread_messages'].get())
|
iterator = limit(iterator, self.config['thread_unread_messages'].get())
|
||||||
for post in iterator:
|
for post in iterator:
|
||||||
message = Message(thread=thread,
|
message = self._post2message(thread, post)
|
||||||
id=post.id,
|
|
||||||
title=post.title,
|
|
||||||
sender=post.author,
|
|
||||||
receivers=None,
|
|
||||||
date=post.date,
|
|
||||||
parent=None,
|
|
||||||
content=post.content,
|
|
||||||
signature=post.signature,
|
|
||||||
children=[],
|
|
||||||
flags=Message.IS_UNREAD|Message.IS_HTML)
|
|
||||||
if child:
|
if child:
|
||||||
message.children.append(child)
|
message.children.append(child)
|
||||||
child.parent = message
|
child.parent = message
|
||||||
|
|
@ -182,9 +179,8 @@ class PhpBBBackend(BaseBackend, ICapMessages):
|
||||||
assert message.thread
|
assert message.thread
|
||||||
|
|
||||||
with self.browser:
|
with self.browser:
|
||||||
return self.browser.post_comment(message.thread.id,
|
return self.browser.post_answer(message.thread.id,
|
||||||
message.parent.id,
|
message.title,
|
||||||
message.title,
|
message.content)
|
||||||
message.content)
|
|
||||||
|
|
||||||
OBJECTS = {Thread: fill_thread}
|
OBJECTS = {Thread: fill_thread}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue