mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Fix 500 on two-way conversation page
We changed the schema used by the endpoint that searches for notifications by recipient. So the admin app was looking for the wrong thing in the JSON. This is hard to catch in tests because it relies on our fixtures matching what the API really returns. This commit fixes the code to use the correct key to lookup the template content from the JSON. This also exposed the fact that we weren’t passing in the personalisation any more (perhaps got lost in the re-reverts somehow) so users were only seeing the template in the inbound view, not the full message content.
This commit is contained in:
@@ -41,14 +41,20 @@ def get_sms_thread(service_id, user_number):
|
||||
), key=lambda notification: notification['created_at']):
|
||||
|
||||
is_inbound = ('notify_number' in notification)
|
||||
redact_personalisation = notification.get('template', {}).get('redact_personalisation', False)
|
||||
|
||||
if redact_personalisation:
|
||||
notification['personalisation'] = {}
|
||||
|
||||
yield {
|
||||
'inbound': is_inbound,
|
||||
'content': SMSPreviewTemplate(
|
||||
{
|
||||
'content': notification.get('content') or notification['body']
|
||||
'content': notification.get('content') or notification['template']['content']
|
||||
},
|
||||
downgrade_non_gsm_characters=(not is_inbound)
|
||||
notification.get('personalisation'),
|
||||
downgrade_non_gsm_characters=(not is_inbound),
|
||||
redact_missing_personalisation=redact_personalisation,
|
||||
),
|
||||
'created_at': notification['created_at'],
|
||||
'status': notification.get('status'),
|
||||
|
||||
Reference in New Issue
Block a user