mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
sometimes attributedTo is a list of strings
This commit is contained in:
parent
3a526e0ca7
commit
cf14b186c1
1 changed files with 13 additions and 8 deletions
|
@ -2222,12 +2222,17 @@ def ensure_domains_match(activity: dict) -> bool:
|
||||||
note_actor = None
|
note_actor = None
|
||||||
if 'actor' in activity:
|
if 'actor' in activity:
|
||||||
note_actor = activity['actor']
|
note_actor = activity['actor']
|
||||||
elif 'attributedTo' in activity and isinstance(activity['attributedTo'], str):
|
elif 'attributedTo' in activity:
|
||||||
note_actor = activity['attributedTo']
|
attributed_to = activity['attributedTo']
|
||||||
elif 'attributedTo' in activity and isinstance(activity['attributedTo'], list):
|
if isinstance(attributed_to, str):
|
||||||
for a in activity['attributedTo']:
|
note_actor = attributed_to
|
||||||
if a['type'] == 'Person':
|
elif isinstance(attributed_to, list):
|
||||||
note_actor = a['id']
|
for a in attributed_to:
|
||||||
|
if isinstance(a, dict) and a.get('type') == 'Person':
|
||||||
|
note_actor = a.get('id')
|
||||||
|
break
|
||||||
|
elif isinstance(a, str):
|
||||||
|
note_actor = a
|
||||||
break
|
break
|
||||||
|
|
||||||
if note_id and note_actor:
|
if note_id and note_actor:
|
||||||
|
|
Loading…
Add table
Reference in a new issue