mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-17 21:18:49 -04:00
Only return non-archived email reply_to addresses
Updated the DAO methods which return a single email reply_to address and all reply_to addresses to only return the non-archived addresses. Changed the type of error that gets raised when using the Admin interface to be BadRequestError instead of a SQLAlchemyError.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app.config import QueueNames
|
||||
from app.dao.service_email_reply_to_dao import dao_get_reply_to_by_id
|
||||
from app.dao.service_sms_sender_dao import dao_get_service_sms_senders_by_id
|
||||
@@ -89,7 +91,11 @@ def get_reply_to_text(notification_type, sender_id, service, template):
|
||||
reply_to = None
|
||||
if sender_id:
|
||||
if notification_type == EMAIL_TYPE:
|
||||
reply_to = dao_get_reply_to_by_id(service.id, sender_id).email_address
|
||||
try:
|
||||
reply_to = dao_get_reply_to_by_id(service.id, sender_id).email_address
|
||||
except NoResultFound:
|
||||
message = 'Reply to email address not found'
|
||||
raise BadRequestError(message=message)
|
||||
elif notification_type == SMS_TYPE:
|
||||
reply_to = dao_get_service_sms_senders_by_id(service.id, sender_id).get_reply_to_text()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user