Use url if available

main
Bob Mottram 2023-01-19 10:24:55 +00:00
parent 0cacbd94a0
commit f368d5d000
1 changed files with 10 additions and 2 deletions

View File

@ -1210,7 +1210,11 @@ def _announce_unattributed_html(translate: {},
announces_str = 'announces'
if translate.get(announces_str):
announces_str = translate[announces_str]
post_id = remove_id_ending(post_json_object['object']['id'])
post_obj = post_json_object['object']
if post_obj.get('url'):
post_id = post_obj['url']
else:
post_id = remove_id_ending(post_obj['id'])
post_link = '/users/' + nickname + '?convthread=' + \
post_id.replace('/', '--')
return ' <img loading="lazy" decoding="async" title="' + \
@ -1231,7 +1235,11 @@ def _announce_with_display_name_html(translate: {},
announces_str = 'announces'
if translate.get(announces_str):
announces_str = translate[announces_str]
post_id = remove_id_ending(post_json_object['object']['id'])
post_obj = post_json_object['object']
if post_obj.get('url'):
post_id = post_obj['url']
else:
post_id = remove_id_ending(post_obj['id'])
post_link = '/users/' + nickname + '?convthread=' + \
post_id.replace('/', '--')
return ' <img loading="lazy" decoding="async" title="' + \