Check for type

main
Bob Mottram 2022-03-23 22:24:49 +00:00
parent 44d386db86
commit 95eed2183a
2 changed files with 13 additions and 7 deletions

View File

@ -6657,14 +6657,16 @@ class PubServer(BaseHTTPRequestHandler):
# this account is a bot
if fields.get('isBot'):
if fields['isBot'] == 'on':
if fields['isBot'] == 'on' and \
actor_json.get('type'):
if actor_json['type'] != 'Service':
actor_json['type'] = 'Service'
actor_changed = True
else:
# this account is a group
if fields.get('isGroup'):
if fields['isGroup'] == 'on':
if fields['isGroup'] == 'on' and \
actor_json.get('type'):
if actor_json['type'] != 'Group':
# only allow admin to create groups
if path.startswith('/users/' +
@ -6673,6 +6675,7 @@ class PubServer(BaseHTTPRequestHandler):
actor_changed = True
else:
# this account is a person (default)
if actor_json.get('type'):
if actor_json['type'] != 'Person':
actor_json['type'] = 'Person'
actor_changed = True
@ -7700,6 +7703,7 @@ class PubServer(BaseHTTPRequestHandler):
moved_to = actor_json['movedTo']
if '"' in moved_to:
moved_to = moved_to.split('"')[1]
if actor_json.get('type'):
if actor_json['type'] == 'Group':
is_group = True
locked_account = get_locked_account(actor_json)

View File

@ -2690,6 +2690,8 @@ def _group_handle(base_dir: str, handle: str) -> bool:
actor_json = load_json(actor_file)
if not actor_json:
return False
if not actor_json.get('type'):
return False
return actor_json['type'] == 'Group'