fix formatting fix

This commit is contained in:
Markus-Rost 2020-10-25 01:52:43 +02:00
parent e0d0350007
commit d729e0bc23

View file

@ -80,7 +80,8 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, article_p
embed["description"] = embed["description"].replace(npost.image_last, "") embed["description"] = embed["description"].replace(npost.image_last, "")
else: # Fallback when model is not available else: # Fallback when model is not available
embed["description"] = post.get("rawContent", "") embed["description"] = post.get("rawContent", "")
embed["footer"]["text"] = post["forumName"].replace("_", " ") if post["forumName"] is not None:
embed["footer"]["text"] = post["forumName"].replace("_", " ")
embed["timestamp"] = datetime.datetime.fromtimestamp(post["creationDate"]["epochSecond"], tz=datetime.timezone.utc).isoformat() embed["timestamp"] = datetime.datetime.fromtimestamp(post["creationDate"]["epochSecond"], tz=datetime.timezone.utc).isoformat()
if post_type == "FORUM": if post_type == "FORUM":
if not post["isReply"]: if not post["isReply"]:
@ -126,7 +127,7 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, article_p
elif post_type == "WALL": elif post_type == "WALL":
user_wall = _("unknown") # Fail safe user_wall = _("unknown") # Fail safe
if post["forumName"].endswith(' Message Wall'): if post["forumName"].endswith(' Message Wall'):
user_wall = post["forumName"][:-13] user_wall = post["forumName"][:-13].replace("_", " ")
if not post["isReply"]: if not post["isReply"]:
embed.event_type = "discussion/wall/post" embed.event_type = "discussion/wall/post"
embed["url"] = "{url}wiki/Message_Wall:{user_wall}?threadId={threadId}".format(url=wiki, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"]) embed["url"] = "{url}wiki/Message_Wall:{user_wall}?threadId={threadId}".format(url=wiki, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"])