mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
prevent public api from sending archived templates
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime, date
|
||||
from datetime import datetime
|
||||
import statsd
|
||||
import itertools
|
||||
from flask import (
|
||||
@@ -30,6 +30,7 @@ from app.schemas import (
|
||||
notifications_filter_schema,
|
||||
notifications_statistics_schema,
|
||||
day_schema,
|
||||
unarchived_template_schema
|
||||
)
|
||||
from app.celery.tasks import send_sms, send_email
|
||||
|
||||
@@ -328,6 +329,10 @@ def send_notification(notification_type):
|
||||
service_id=service_id
|
||||
)
|
||||
|
||||
errors = unarchived_template_schema.validate({'archived': template.archived})
|
||||
if errors:
|
||||
return jsonify(result='error', message=errors), 400
|
||||
|
||||
template_object = Template(template.__dict__, notification.get('personalisation', {}))
|
||||
if template_object.missing_data:
|
||||
return jsonify(
|
||||
|
||||
Reference in New Issue
Block a user