Less indentation

merge-requests/30/head
Bob Mottram 2024-08-05 10:32:40 +01:00
parent edc5a8c463
commit b2201d33f1
1 changed files with 26 additions and 24 deletions

View File

@ -5443,30 +5443,32 @@ def local_only_is_local(message_json: {}, domain_full: str) -> bool:
def post_summary_contains_links(message_json: {}) -> bool: def post_summary_contains_links(message_json: {}) -> bool:
"""check if the json post summary contains links """check if the json post summary contains links
""" """
if message_json['object'].get('type') and \ if not (message_json['object'].get('type') and
message_json['object'].get('summary'): message_json['object'].get('summary')):
if message_json['object']['type'] != 'Person' and \ return False
message_json['object']['type'] != 'Application' and \
message_json['object']['type'] != 'Group': if message_json['object']['type'] != 'Person' and \
if len(message_json['object']['summary']) > 1024: message_json['object']['type'] != 'Application' and \
actor_url = get_actor_from_post(message_json) message_json['object']['type'] != 'Group':
print('INBOX: summary is too long ' + if len(message_json['object']['summary']) > 1024:
actor_url + ' ' + actor_url = get_actor_from_post(message_json)
message_json['object']['summary']) print('INBOX: summary is too long ' +
return True actor_url + ' ' +
if '://' in message_json['object']['summary']: message_json['object']['summary'])
actor_url = get_actor_from_post(message_json) return True
print('INBOX: summary should not contain links ' + if '://' in message_json['object']['summary']:
actor_url + ' ' + actor_url = get_actor_from_post(message_json)
message_json['object']['summary']) print('INBOX: summary should not contain links ' +
return True actor_url + ' ' +
else: message_json['object']['summary'])
if len(message_json['object']['summary']) > 4096: return True
actor_url = get_actor_from_post(message_json) else:
print('INBOX: person summary is too long ' + if len(message_json['object']['summary']) > 4096:
actor_url + ' ' + actor_url = get_actor_from_post(message_json)
message_json['object']['summary']) print('INBOX: person summary is too long ' +
return True actor_url + ' ' +
message_json['object']['summary'])
return True
return False return False