Fix for missing mentions

Fixes #9
This commit is contained in:
Michael Thomas 2023-03-15 16:42:42 +00:00
parent ffc80a5081
commit 7165154570

View file

@ -363,15 +363,15 @@ def get_replied_toot_server_id(server, toot, replied_toot_server_ids,parsed_urls
"""get the server and ID of the toot the given toot replied to""" """get the server and ID of the toot the given toot replied to"""
in_reply_to_id = toot["in_reply_to_id"] in_reply_to_id = toot["in_reply_to_id"]
in_reply_to_account_id = toot["in_reply_to_account_id"] in_reply_to_account_id = toot["in_reply_to_account_id"]
mentions = toot["mentions"] mentions = [
mention
for mention in toot["mentions"]
if mention["id"] == in_reply_to_account_id
]
if len(mentions) == 0: if len(mentions) == 0:
return None return None
mention = [ mention = mentions[0]
mention
for mention in mentions
if mention["id"] == in_reply_to_account_id
][0]
o_url = f"https://{server}/@{mention['acct']}/{in_reply_to_id}" o_url = f"https://{server}/@{mention['acct']}/{in_reply_to_id}"
if o_url in replied_toot_server_ids: if o_url in replied_toot_server_ids: