mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Don't crash when Fandom has no pageID assigned to comment yet
This commit is contained in:
parent
ab67bc64cd
commit
f5d1a35619
|
@ -47,7 +47,7 @@ async def feeds_compact_formatter(post_type, post, message_target, wiki, article
|
||||||
message = "📩 "+_("[{author}]({author_url}) created a [reply](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}#{replyId}>) to [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, url=wiki, title=post["_embedded"]["thread"][0]["title"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"], replyId=post["id"])
|
message = "📩 "+_("[{author}]({author_url}) created a [reply](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}#{replyId}>) to [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, url=wiki, title=post["_embedded"]["thread"][0]["title"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"], replyId=post["id"])
|
||||||
elif post_type == "ARTICLE_COMMENT":
|
elif post_type == "ARTICLE_COMMENT":
|
||||||
if article_page is None:
|
if article_page is None:
|
||||||
article_page = {"title": _("unknown"), "fullUrl": "{wiki}wiki/{article}".format(wiki=wiki, article=_("unknown").replace(" ", "_"))} # No page known
|
article_page = {"title": _("unknown"), "fullUrl": wiki} # No page known
|
||||||
if not post["isReply"]:
|
if not post["isReply"]:
|
||||||
message = "🗒️ "+_("[{author}]({author_url}) created a [comment](<{url}?commentId={commentId}>) on [{article}](<{url}>)").format(author=author, author_url=author_url, url=article_page["fullUrl"], article=article_page["title"], commentId=post["threadId"])
|
message = "🗒️ "+_("[{author}]({author_url}) created a [comment](<{url}?commentId={commentId}>) on [{article}](<{url}>)").format(author=author, author_url=author_url, url=article_page["fullUrl"], article=article_page["title"], commentId=post["threadId"])
|
||||||
else:
|
else:
|
||||||
|
@ -137,7 +137,7 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, article_p
|
||||||
embed["title"] = _("Replied to \"{title}\" on {user}'s Message Wall").format(title=post["_embedded"]["thread"][0]["title"], user=user_wall)
|
embed["title"] = _("Replied to \"{title}\" on {user}'s Message Wall").format(title=post["_embedded"]["thread"][0]["title"], user=user_wall)
|
||||||
elif post_type == "ARTICLE_COMMENT":
|
elif post_type == "ARTICLE_COMMENT":
|
||||||
if article_page is None:
|
if article_page is None:
|
||||||
article_page = {"title": _("unknown"), "fullUrl": "{wiki}wiki/{article}".format(wiki=wiki, article=_("unknown").replace(" ", "_"))} # No page known
|
article_page = {"title": _("unknown"), "fullUrl": wiki} # No page known
|
||||||
if not post["isReply"]:
|
if not post["isReply"]:
|
||||||
embed.event_type = "discussion/comment/post"
|
embed.event_type = "discussion/comment/post"
|
||||||
embed["url"] = "{url}?commentId={commentId}".format(url=article_page["fullUrl"], commentId=post["threadId"])
|
embed["url"] = "{url}?commentId={commentId}".format(url=article_page["fullUrl"], commentId=post["threadId"])
|
||||||
|
|
|
@ -245,6 +245,7 @@ async def essential_feeds(change: dict, comment_pages: dict, db_wiki: sqlite3.Ro
|
||||||
identification_string = change["_embedded"]["thread"][0]["containerType"]
|
identification_string = change["_embedded"]["thread"][0]["containerType"]
|
||||||
comment_page = None
|
comment_page = None
|
||||||
if identification_string == "ARTICLE_COMMENT" and comment_pages is not None:
|
if identification_string == "ARTICLE_COMMENT" and comment_pages is not None:
|
||||||
comment_page = comment_pages[change["forumId"]]
|
comment_page = comment_pages.get(change["forumId"], None)
|
||||||
|
if comment_page is not None:
|
||||||
comment_page["fullUrl"] = "/".join(db_wiki["wiki"].split("/", 3)[:3]) + comment_page["relativeUrl"]
|
comment_page["fullUrl"] = "/".join(db_wiki["wiki"].split("/", 3)[:3]) + comment_page["relativeUrl"]
|
||||||
await appearance_mode(identification_string, change, target, db_wiki["wiki"], article_page=comment_page)
|
await appearance_mode(identification_string, change, target, db_wiki["wiki"], article_page=comment_page)
|
||||||
|
|
Loading…
Reference in a new issue