mirror of https://gitlab.com/bashrc2/epicyon
Check announces
parent
38c1d68816
commit
469e8304be
10
announce.py
10
announce.py
|
@ -76,9 +76,17 @@ def outboxAnnounce(recentPostsCache: {},
|
||||||
def announcedByPerson(postJsonObject: {}, nickname: str, domain: str) -> bool:
|
def announcedByPerson(postJsonObject: {}, nickname: str, domain: str) -> bool:
|
||||||
"""Returns True if the given post is announced by the given person
|
"""Returns True if the given post is announced by the given person
|
||||||
"""
|
"""
|
||||||
|
if not postJsonObject.get('type'):
|
||||||
|
return False
|
||||||
if not postJsonObject.get('object'):
|
if not postJsonObject.get('object'):
|
||||||
return False
|
return False
|
||||||
if not isinstance(postJsonObject['object'], dict):
|
if isinstance(postJsonObject['object'], str):
|
||||||
|
if postJsonObject['type'] == 'Announce' and \
|
||||||
|
postJsonObject.get('actor'):
|
||||||
|
actorMatch = domain + '/users/' + nickname
|
||||||
|
if postJsonObject['actor'].endswith(actorMatch):
|
||||||
|
return True
|
||||||
|
elif not isinstance(postJsonObject['object'], dict):
|
||||||
return False
|
return False
|
||||||
# not to be confused with shared items
|
# not to be confused with shared items
|
||||||
if not postJsonObject['object'].get('shares'):
|
if not postJsonObject['object'].get('shares'):
|
||||||
|
|
Loading…
Reference in New Issue