Fix discussion issue for new wikis in the feed

This commit is contained in:
Frisk 2024-08-30 10:26:55 +02:00
parent fbfa5a1e49
commit a4d9aab979

View file

@ -454,6 +454,8 @@ async def discussion_handler():
except: except:
logger.exception("On loading json of response.") logger.exception("On loading json of response.")
continue continue
if isinstance(discussion_feed, list) and any(discussion_feed) is False:
continue
if db_wiki["postid"] is None: # new wiki, just get the last post to not spam the channel if db_wiki["postid"] is None: # new wiki, just get the last post to not spam the channel
if len(discussion_feed) > 0: if len(discussion_feed) > 0:
DBHandler.add(db_wiki["wiki"], discussion_feed[-1]["id"], True) DBHandler.add(db_wiki["wiki"], discussion_feed[-1]["id"], True)
@ -463,8 +465,6 @@ async def discussion_handler():
continue continue
comment_events = [] comment_events = []
targets = await generate_targets(db_wiki["wiki"], "AND NOT postid = '-1'") targets = await generate_targets(db_wiki["wiki"], "AND NOT postid = '-1'")
if isinstance(discussion_feed, list) and any(discussion_feed) is False:
continue
for post in discussion_feed: for post in discussion_feed:
if post["_embedded"]["thread"][0]["containerType"] == "ARTICLE_COMMENT" and post["id"] > db_wiki["postid"]: if post["_embedded"]["thread"][0]["containerType"] == "ARTICLE_COMMENT" and post["id"] > db_wiki["postid"]:
comment_events.append(post["forumId"]) comment_events.append(post["forumId"])