add template body, version, and subject to send_notification api

This commit is contained in:
Leo Hemsted
2016-06-15 12:11:48 +01:00
parent 5a66884f0e
commit 2b13033e85
2 changed files with 60 additions and 17 deletions

View File

@@ -392,7 +392,25 @@ def send_notification(notification_type):
), queue='email')
statsd_client.incr('notifications.api.{}'.format(notification_type))
return jsonify(data={"notification": {"id": notification_id}}), 201
return jsonify(
data=get_notification_return_data(
notification_id,
notification,
template_object)
), 201
def get_notification_return_data(notification_id, notification, template):
output = {
'body': template.replaced,
'template_version': notification['template_version'],
'notification': {'id': notification_id}
}
if template.template_type == 'email':
output.update({'subject': template.subject})
return output
@notifications.route('/notifications/statistics')