mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 01:02:09 -05:00
Use model to work out whether to prefix message
`service.sms_sender` has been deprecated; we should be looking at which of the service’s SMS senders is default to work out if the message has been sent from GOVUK or not (and if it has, then prefix the message with the service name). The arguments to `SMSMessageTemplate` are _super_ badly named – `sender` isn’t really used as a string, it’s a boolean that effectively means ‘is this a custom sender (`True`) or the platform default (`False`)’. We should rename it once this bug is fixed.
This commit is contained in:
@@ -47,11 +47,14 @@ def send_sms_to_provider(notification):
|
||||
"Starting sending SMS {} to provider at {}".format(notification.id, datetime.utcnow())
|
||||
)
|
||||
template_model = dao_get_template_by_id(notification.template_id, notification.template_version)
|
||||
|
||||
sender_has_been_customised = (not service.prefix_sms_with_service_name())
|
||||
|
||||
template = SMSMessageTemplate(
|
||||
template_model.__dict__,
|
||||
values=notification.personalisation,
|
||||
prefix=service.name,
|
||||
sender=service.sms_sender not in {None, current_app.config['FROM_NUMBER']}
|
||||
sender=sender_has_been_customised,
|
||||
)
|
||||
|
||||
if service.research_mode or notification.key_type == KEY_TYPE_TEST:
|
||||
|
||||
Reference in New Issue
Block a user