Added support for displaying and opening wall posts as attachments in conversations
This commit is contained in:
@@ -1302,6 +1302,8 @@ class chatBuffer(baseBuffer):
|
||||
break
|
||||
if url != "":
|
||||
webbrowser.open_new_tab(url)
|
||||
if attachment["type"] == "wall":
|
||||
pub.sendMessage("open-post", post_object=attachment["wall"], controller_="displayPost")
|
||||
else:
|
||||
log.debug("Unhandled attachment: %r" % (attachment,))
|
||||
|
||||
|
@@ -75,6 +75,14 @@ def add_attachment(attachment):
|
||||
elif attachment["type"] == "poll":
|
||||
tpe = _("Poll")
|
||||
msg = attachment["poll"]["question"]
|
||||
elif attachment["type"] == "wall":
|
||||
tpe = _("Post")
|
||||
user = attachment["wall"]["from"]["name"]
|
||||
if len(attachment["wall"]["text"]) > 140:
|
||||
text = attachment["wall"]["text"][:145]+"..."
|
||||
else:
|
||||
text = attachment["wall"]["text"]
|
||||
msg = _("{user}: {post}").format(user=user, post=text)
|
||||
else:
|
||||
print(attachment)
|
||||
return [tpe, msg]
|
||||
|
Reference in New Issue
Block a user