mirror of https://gitlab.com/bashrc2/epicyon
reply control for pixelfed capabilities
parent
29ddb00090
commit
ad4d30a1bb
10
inbox.py
10
inbox.py
|
@ -3355,7 +3355,11 @@ def json_post_allows_comments(post_json_object: {}) -> bool:
|
|||
if 'capabilities' in post_json_object:
|
||||
if isinstance(post_json_object['capabilities'], dict):
|
||||
if 'reply' in post_json_object['capabilities']:
|
||||
if isinstance(post_json_object['capabilities']['reply'], str):
|
||||
reply_control = post_json_object['capabilities']['reply']
|
||||
else:
|
||||
# capabilities exist but there is no reply field
|
||||
reply_control = 'noreply'
|
||||
obj_dict_exists = False
|
||||
if has_object_dict(post_json_object):
|
||||
obj_dict_exists = True
|
||||
|
@ -3365,9 +3369,15 @@ def json_post_allows_comments(post_json_object: {}) -> bool:
|
|||
if 'capabilities' in post_obj:
|
||||
if isinstance(post_obj['capabilities'], dict):
|
||||
if 'reply' in post_obj['capabilities']:
|
||||
if isinstance(post_obj['capabilities']['reply'], str):
|
||||
reply_control = post_obj['capabilities']['reply']
|
||||
else:
|
||||
# capabilities exist but there is no reply field
|
||||
reply_control = 'noreply'
|
||||
if reply_control:
|
||||
if isinstance(reply_control, str):
|
||||
if reply_control == 'noreply':
|
||||
return False
|
||||
if not reply_control.endswith('#Public'):
|
||||
# TODO handle non-public reply permissions
|
||||
print('CAPABILITIES: replies ' + str(reply_control))
|
||||
|
|
6
utils.py
6
utils.py
|
@ -4237,12 +4237,16 @@ def disallow_announce(content: str, attachment: [], capabilities: {}) -> bool:
|
|||
"""Are announces/boosts not allowed for the given post?
|
||||
"""
|
||||
# pixelfed style capabilities
|
||||
if capabilities.get('announce'):
|
||||
if capabilities:
|
||||
if 'announce' in capabilities:
|
||||
if isinstance(capabilities['announce'], str):
|
||||
if not capabilities['announce'].endswith('#Public'):
|
||||
# TODO handle non-public announce permissions
|
||||
print('CAPABILITIES: announce ' + capabilities['announce'])
|
||||
return True
|
||||
else:
|
||||
# capabilities exist but with no announce defined
|
||||
return True
|
||||
|
||||
# emojis
|
||||
disallow_strings = (
|
||||
|
|
Loading…
Reference in New Issue