mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Only return active SMS senders
Updated the DAO methods which return a single SMS sender and all SMS senders to only return the non-archived senders. Changed the error raised in the Admin interface from a SQLAlchemyError to a BadRequestError.
This commit is contained in:
@@ -90,14 +90,15 @@ def send_one_off_notification(service_id, post_data):
|
||||
def get_reply_to_text(notification_type, sender_id, service, template):
|
||||
reply_to = None
|
||||
if sender_id:
|
||||
if notification_type == EMAIL_TYPE:
|
||||
try:
|
||||
reply_to = dao_get_reply_to_by_id(service.id, sender_id).email_address
|
||||
except NoResultFound:
|
||||
try:
|
||||
if notification_type == EMAIL_TYPE:
|
||||
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()
|
||||
reply_to = dao_get_reply_to_by_id(service.id, sender_id).email_address
|
||||
elif notification_type == SMS_TYPE:
|
||||
message = 'SMS sender not found'
|
||||
reply_to = dao_get_service_sms_senders_by_id(service.id, sender_id).get_reply_to_text()
|
||||
except NoResultFound:
|
||||
raise BadRequestError(message=message)
|
||||
else:
|
||||
reply_to = template.get_reply_to_text()
|
||||
return reply_to
|
||||
|
||||
Reference in New Issue
Block a user