From 97ea349a69c6862f44c54367ed69c1092f86cdf8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Oct 2019 20:07:23 +0100 Subject: [PATCH] Mentions included in replies --- posts.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/posts.py b/posts.py index 4384b32f..b3f0874f 100644 --- a/posts.py +++ b/posts.py @@ -1866,11 +1866,22 @@ def isReply(postJsonObject: {},actor: str) -> bool: return False if postJsonObject['object']['type']!='Note': return False - if not postJsonObject['object'].get('inReplyTo'): + if postJsonObject['object'].get('inReplyTo'): + if postJsonObject['object']['inReplyTo'].startswith(actor): + return True + if not postJsonObject['object'].get('tag'): return False - if not postJsonObject['object']['inReplyTo'].startswith(actor): + if not isinstance(postJsonObject['object']['tag'], list): return False - return True + for tag in postJsonObject['object']['tag']: + if not tag.get('type'): + continue + if tag['type']=='Mention': + if not tag.get('href'): + continue + if actor in tag['href']: + return True + return False def createBoxIndex(boxDir: str,postsInBoxDict: {}) -> int: """ Creates an index for the given box