mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-25 10:29:14 -04:00
Merge pull request #1516 from alphagov/empty-inbound-sms
make sure inbound sms page doesn't break if you receive a blank inbou…
This commit is contained in:
@@ -107,7 +107,7 @@ class Development(Config):
|
||||
class Test(Development):
|
||||
DEBUG = True
|
||||
TESTING = True
|
||||
STATSD_ENABLED = True
|
||||
STATSD_ENABLED = False
|
||||
WTF_CSRF_ENABLED = False
|
||||
CSV_UPLOAD_BUCKET_NAME = 'test-notifications-csv-upload'
|
||||
LOGO_UPLOAD_BUCKET_NAME = 'public-logos-test'
|
||||
|
||||
@@ -64,7 +64,7 @@ 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)
|
||||
redact_personalisation = not is_inbound and notification['template']['redact_personalisation']
|
||||
|
||||
if redact_personalisation:
|
||||
notification['personalisation'] = {}
|
||||
@@ -73,7 +73,10 @@ def get_sms_thread(service_id, user_number):
|
||||
'inbound': is_inbound,
|
||||
'content': SMSPreviewTemplate(
|
||||
{
|
||||
'content': notification.get('content') or notification['template']['content']
|
||||
'content': (
|
||||
notification['content'] if is_inbound else
|
||||
notification['template']['content']
|
||||
)
|
||||
},
|
||||
notification.get('personalisation'),
|
||||
downgrade_non_gsm_characters=(not is_inbound),
|
||||
|
||||
Reference in New Issue
Block a user