mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Insert a row for the mapping of notification to email_reply_to for one off notifications.
This commit is contained in:
@@ -138,7 +138,7 @@ def validate_template(template_id, personalisation, service, notification_type):
|
||||
def check_service_email_reply_to_id(service_id, reply_to_id):
|
||||
if not (reply_to_id is None):
|
||||
try:
|
||||
reply_to = dao_get_reply_to_by_id(service_id, reply_to_id)
|
||||
dao_get_reply_to_by_id(service_id, reply_to_id)
|
||||
except NoResultFound:
|
||||
message = 'email_reply_to_id {} does not exist in database for service id {}'\
|
||||
.format(reply_to_id, service_id)
|
||||
|
||||
@@ -3,17 +3,17 @@ from app.notifications.validators import (
|
||||
check_service_over_daily_message_limit,
|
||||
validate_and_format_recipient,
|
||||
validate_template,
|
||||
)
|
||||
check_service_email_reply_to_id)
|
||||
from app.notifications.process_notifications import (
|
||||
create_content_for_notification,
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
)
|
||||
persist_email_reply_to_id_for_notification)
|
||||
from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
PRIORITY,
|
||||
SMS_TYPE,
|
||||
)
|
||||
EMAIL_TYPE)
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from app.dao.templates_dao import dao_get_template_by_id_and_service_id
|
||||
from app.dao.users_dao import get_user_by_id
|
||||
@@ -63,6 +63,10 @@ def send_one_off_notification(service_id, post_data):
|
||||
key_type=KEY_TYPE_NORMAL,
|
||||
created_by_id=post_data['created_by']
|
||||
)
|
||||
sender_id = post_data.get('sender_id', None)
|
||||
if sender_id and template.template_type == EMAIL_TYPE:
|
||||
check_service_email_reply_to_id(service_id, sender_id)
|
||||
persist_email_reply_to_id_for_notification(notification.id, sender_id)
|
||||
|
||||
queue_name = QueueNames.PRIORITY if template.process_type == PRIORITY else None
|
||||
send_notification_to_queue(
|
||||
|
||||
Reference in New Issue
Block a user