ensure we're passing through api keys and key types from notifications

when we made the change to async persist notifications, we forgot to
pass through api_key_id and key_type. in send_sms/email, for legacy
reasons, they default to None/KEY_TYPE_NORMAL, so regardless of what
your api key was set up as, we would send real messages!

TODO: Once the PaaS transition is complete and the task changes are
reverted, remove the api_key_id and key_type params from the send_*
tasks entirely, as those are only called from the csv job flow, and
don't need them
This commit is contained in:
Leo Hemsted
2017-03-28 13:14:46 +01:00
parent d5f8b4d80b
commit 25d1777937
4 changed files with 85 additions and 20 deletions

View File

@@ -68,12 +68,14 @@ def post_notification(notification_type):
if not simulated:
tasks.send_notification_to_persist_queue(
notification.id,
service,
template.template_type,
encrypted,
template.process_type == PRIORITY,
service.research_mode or api_user.key_type == KEY_TYPE_TEST
notification_id=notification.id,
service=service,
template_type=template.template_type,
encrypted=encrypted,
api_key_id=str(notification.api_key_id),
key_type=api_user.key_type,
priority=template.process_type == PRIORITY,
research_mode=service.research_mode or api_user.key_type == KEY_TYPE_TEST
)
# not doing this during paas migration
# queue_name = 'notify' if template.process_type == PRIORITY else None