forked from indymedia/epicyon
dms are not necessarily replies
parent
e84bf4d726
commit
171f23e751
49
posts.py
49
posts.py
|
@ -1894,29 +1894,34 @@ def isImageMedia(session,baseDir: str,httpPrefix: str,nickname: str,domain: str,
|
||||||
def isReply(postJsonObject: {},actor: str) -> bool:
|
def isReply(postJsonObject: {},actor: str) -> bool:
|
||||||
"""Returns true if the given post is a reply to the given actor
|
"""Returns true if the given post is a reply to the given actor
|
||||||
"""
|
"""
|
||||||
if postJsonObject['type']!='Create':
|
if isDM(postJsonObject):
|
||||||
return False
|
if postJsonObject['object'].get('inReplyTo'):
|
||||||
if not postJsonObject.get('object'):
|
if postJsonObject['object']['inReplyTo'].startswith(actor):
|
||||||
return False
|
return True
|
||||||
if not isinstance(postJsonObject['object'], dict):
|
else:
|
||||||
return False
|
if postJsonObject['type']!='Create':
|
||||||
if postJsonObject['object']['type']!='Note':
|
return False
|
||||||
return False
|
if not postJsonObject.get('object'):
|
||||||
if postJsonObject['object'].get('inReplyTo'):
|
return False
|
||||||
if postJsonObject['object']['inReplyTo'].startswith(actor):
|
if not isinstance(postJsonObject['object'], dict):
|
||||||
return True
|
return False
|
||||||
if not postJsonObject['object'].get('tag'):
|
if postJsonObject['object']['type']!='Note':
|
||||||
return False
|
return False
|
||||||
if not isinstance(postJsonObject['object']['tag'], list):
|
if postJsonObject['object'].get('inReplyTo'):
|
||||||
return False
|
if postJsonObject['object']['inReplyTo'].startswith(actor):
|
||||||
for tag in postJsonObject['object']['tag']:
|
return True
|
||||||
if not tag.get('type'):
|
if not postJsonObject['object'].get('tag'):
|
||||||
continue
|
return False
|
||||||
if tag['type']=='Mention':
|
if not isinstance(postJsonObject['object']['tag'], list):
|
||||||
if not tag.get('href'):
|
return False
|
||||||
|
for tag in postJsonObject['object']['tag']:
|
||||||
|
if not tag.get('type'):
|
||||||
continue
|
continue
|
||||||
if actor in tag['href']:
|
if tag['type']=='Mention':
|
||||||
return True
|
if not tag.get('href'):
|
||||||
|
continue
|
||||||
|
if actor in tag['href']:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def createBoxIndex(boxDir: str,postsInBoxDict: {}) -> int:
|
def createBoxIndex(boxDir: str,postsInBoxDict: {}) -> int:
|
||||||
|
|
Loading…
Reference in New Issue