mirror of https://gitlab.com/bashrc2/epicyon
Handle posts where 'to' is a string rather than a list
parent
fc0f8d1764
commit
6ee7fd3bf4
8
utils.py
8
utils.py
|
@ -2279,6 +2279,7 @@ def is_dm(post_json_object: {}) -> bool:
|
|||
for field_name in fields:
|
||||
if not post_json_object['object'].get(field_name):
|
||||
continue
|
||||
if isinstance(post_json_object['object'][field_name], list):
|
||||
for to_address in post_json_object['object'][field_name]:
|
||||
if to_address.endswith('#Public') or \
|
||||
to_address == 'as:Public' or \
|
||||
|
@ -2286,6 +2287,9 @@ def is_dm(post_json_object: {}) -> bool:
|
|||
return False
|
||||
if to_address.endswith('followers'):
|
||||
return False
|
||||
elif isinstance(post_json_object['object'][field_name], str):
|
||||
if post_json_object['object'][field_name].endswith('#Public'):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2614,11 +2618,15 @@ def is_public_post(post_json_object: {}) -> bool:
|
|||
return False
|
||||
if not post_json_object['object'].get('to'):
|
||||
return False
|
||||
if isinstance(post_json_object['object']['to'], list):
|
||||
for recipient in post_json_object['object']['to']:
|
||||
if recipient.endswith('#Public') or \
|
||||
recipient == 'as:Public' or \
|
||||
recipient == 'Public':
|
||||
return True
|
||||
elif isinstance(post_json_object['object']['to'], str):
|
||||
if post_json_object['object']['to'].endswith('#Public'):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue