Mentions included in replies

main2
Bob Mottram 2019-10-22 20:07:23 +01:00
parent a8c177cbd1
commit 97ea349a69
1 changed files with 14 additions and 3 deletions

View File

@ -1866,11 +1866,22 @@ def isReply(postJsonObject: {},actor: str) -> bool:
return False return False
if postJsonObject['object']['type']!='Note': if postJsonObject['object']['type']!='Note':
return False 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 return False
if not postJsonObject['object']['inReplyTo'].startswith(actor): if not isinstance(postJsonObject['object']['tag'], list):
return False 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: def createBoxIndex(boxDir: str,postsInBoxDict: {}) -> int:
""" Creates an index for the given box """ Creates an index for the given box