Now that we allow multiple SMS senders for a service, update the sender for SMS to be the default SMS sender, regardless if it is inbound number or not

This commit is contained in:
Rebecca Law
2017-10-24 13:37:17 +01:00
parent ce13e62d84
commit 8d6c38e1fe
6 changed files with 55 additions and 27 deletions

View File

@@ -73,7 +73,7 @@ def send_sms_to_provider(notification):
to=validate_and_format_phone_number(notification.to, international=notification.international),
content=str(template),
reference=str(notification.id),
sender=service.get_inbound_number()
sender=service.get_default_sms_sender()
)
except Exception as e:
dao_toggle_sms_provider(provider.name)

View File

@@ -275,8 +275,6 @@ class Service(db.Model, Versioned):
def get_inbound_number(self):
if self.inbound_number and self.inbound_number.active:
return self.inbound_number.number
else:
return self.get_default_sms_sender()
def get_default_sms_sender(self):
default_sms_sender = [x for x in self.service_sms_senders if x.is_default]

View File

@@ -95,7 +95,7 @@ def post_notification(notification_type):
if notification_type == SMS_TYPE:
create_resp_partial = functools.partial(
create_post_sms_response_from_notification,
from_number=authenticated_service.get_inbound_number()
from_number=authenticated_service.get_default_sms_sender()
)
elif notification_type == EMAIL_TYPE:
create_resp_partial = functools.partial(