mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Merge branch 'master' into research-mode-implementation
This commit is contained in:
@@ -220,13 +220,11 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
|
||||
|
||||
provider = provider_to_use('sms', notification_id)
|
||||
|
||||
restricted = False
|
||||
|
||||
if not service_allowed_to_send_to(notification['to'], service):
|
||||
current_app.logger.info(
|
||||
"SMS {} failed as restricted service".format(notification_id)
|
||||
)
|
||||
restricted = True
|
||||
return
|
||||
|
||||
try:
|
||||
|
||||
@@ -245,7 +243,7 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
|
||||
service_id=service_id,
|
||||
job_id=notification.get('job', None),
|
||||
job_row_number=notification.get('row_number', None),
|
||||
status='failed' if restricted else 'sending',
|
||||
status='sending',
|
||||
created_at=datetime.strptime(created_at, DATETIME_FORMAT),
|
||||
sent_at=sent_at,
|
||||
sent_by=provider.get_name(),
|
||||
@@ -258,9 +256,6 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
|
||||
)
|
||||
dao_create_notification(notification_db_object, TEMPLATE_TYPE_SMS, provider.get_name())
|
||||
|
||||
if restricted:
|
||||
return
|
||||
|
||||
try:
|
||||
if service.research_mode:
|
||||
send_sms_response.apply_async(
|
||||
@@ -298,13 +293,11 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
|
||||
|
||||
provider = provider_to_use('email', notification_id)
|
||||
|
||||
restricted = False
|
||||
|
||||
if not service_allowed_to_send_to(notification['to'], service):
|
||||
current_app.logger.info(
|
||||
"Email {} failed as restricted service".format(notification_id)
|
||||
)
|
||||
restricted = True
|
||||
return
|
||||
|
||||
try:
|
||||
sent_at = datetime.utcnow()
|
||||
@@ -316,7 +309,7 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
|
||||
service_id=service_id,
|
||||
job_id=notification.get('job', None),
|
||||
job_row_number=notification.get('row_number', None),
|
||||
status='failed' if restricted else 'sending',
|
||||
status='sending',
|
||||
created_at=datetime.strptime(created_at, DATETIME_FORMAT),
|
||||
sent_at=sent_at,
|
||||
sent_by=provider.get_name()
|
||||
@@ -329,9 +322,6 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
|
||||
datetime.strptime(created_at, DATETIME_FORMAT)
|
||||
)
|
||||
|
||||
if restricted:
|
||||
return
|
||||
|
||||
try:
|
||||
template = Template(
|
||||
dao_get_template_by_id(notification['template'], notification['template_version']).__dict__,
|
||||
|
||||
Reference in New Issue
Block a user