mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 18:22:37 -04:00
Make send the send flow generic
This commit parameterises all methods in the send view so that they can send either emails or SMS messages. It works out what kind of message it is sending from the `template_type` property of the template object. This means that the `Template` util class needs to know about these properties, which means that this commit depends on: https://github.com/alphagov/notifications-utils/pull/2 This commit does _not_ add tests for sending emails. The existing tests for sending SMS still pass, but actually sending emails is outside the scope of this story.
This commit is contained in:
@@ -4,14 +4,14 @@ from app.utils import BrowsableItem
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
|
||||
def insert_service_template(name, content, service_id, subject=None):
|
||||
def insert_service_template(name, type_, content, service_id, subject=None):
|
||||
return notifications_api_client.create_service_template(
|
||||
name, 'sms' if subject is None else 'email', content, service_id, subject)
|
||||
name, type_, content, service_id, subject)
|
||||
|
||||
|
||||
def update_service_template(id_, name, content, service_id, subject=None):
|
||||
def update_service_template(id_, name, type_, content, service_id, subject=None):
|
||||
return notifications_api_client.update_service_template(
|
||||
id_, name, 'sms', content, service_id)
|
||||
id_, name, type_, content, service_id)
|
||||
|
||||
|
||||
def get_service_templates(service_id):
|
||||
|
||||
Reference in New Issue
Block a user