From 716515457018eae3201bd2ee59055e79c869ccd4 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Wed, 15 Mar 2023 16:42:42 +0000 Subject: [PATCH] Fix for missing mentions Fixes #9 --- get_context.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/get_context.py b/get_context.py index 9f6f882..5363f96 100644 --- a/get_context.py +++ b/get_context.py @@ -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""" in_reply_to_id = toot["in_reply_to_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: return None - mention = [ - mention - for mention in mentions - if mention["id"] == in_reply_to_account_id - ][0] + mention = mentions[0] o_url = f"https://{server}/@{mention['acct']}/{in_reply_to_id}" if o_url in replied_toot_server_ids: