more bug fixes for user page with Object with bare string id object

fixes https://console.cloud.google.com/errors/detail/CPORrJ7MxPCtZg;time=P30D?project=bridgy-federated
pull/438/head
Ryan Barrett 2023-03-03 10:07:54 -08:00
rodzic 126a766d40
commit 56dacb1258
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -204,19 +204,21 @@ def fetch_objects(query, user):
}
obj.phrase = phrases.get(type)
# TODO: unify inner object loading? optionally fetch external?
inner_obj = as1.get_object(obj.as1)
if inner_obj.keys() == set(['id']):
inner_obj_obj = Object.get_by_id(inner_obj['id'])
if inner_obj_obj:
inner_obj = inner_obj_obj.as1
# TODO: revisit? we have objects in the datastore, that are basically
# empty, eg just as1 {'objectType': 'note'}, which make this show --s
# if inner_obj.keys() == set(['id']):
# inner_obj_obj = Object.get_by_id(inner_obj['id'])
# if inner_obj_obj and inner_obj_obj.as1:
# inner_obj = inner_obj_obj.as1
content = (inner_obj.get('content')
or inner_obj.get('displayName')
or inner_obj.get('summary'))
url = util.get_first(inner_obj, 'url') or inner_obj.get('id')
if (obj.domains and
inner_obj.get('id', '').strip('/') == f'https://{obj.domains[0]}'):
if (type == 'update' and obj.domains and
inner_obj.get('id', '').strip('/') == f'https://{obj.domains[0]}'):
obj.phrase = 'updated'
obj.as1.update({
'content': 'their profile',