Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history

This commit is contained in:
venusbb
2017-11-02 12:38:52 +00:00
36 changed files with 599 additions and 512 deletions

View File

@@ -2,13 +2,13 @@ from app.config import QueueNames
from app.notifications.validators import (
check_service_over_daily_message_limit,
validate_and_format_recipient,
validate_template,
check_service_email_reply_to_id)
validate_template)
from app.notifications.process_notifications import (
create_content_for_notification,
persist_notification,
send_notification_to_queue,
persist_email_reply_to_id_for_notification)
persist_email_reply_to_id_for_notification,
persist_sms_sender_id_for_notification
)
from app.models import (
KEY_TYPE_NORMAL,
PRIORITY,
@@ -64,9 +64,11 @@ def send_one_off_notification(service_id, post_data):
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)
if sender_id:
if template.template_type == EMAIL_TYPE:
persist_email_reply_to_id_for_notification(notification.id, sender_id)
if template.template_type == SMS_TYPE:
persist_sms_sender_id_for_notification(notification.id, sender_id)
queue_name = QueueNames.PRIORITY if template.process_type == PRIORITY else None
send_notification_to_queue(

View File

@@ -1,12 +1,13 @@
import itertools
from app.dao.date_util import get_financial_year
from app.models import (
ServiceWhitelist,
MOBILE_TYPE, EMAIL_TYPE,
KEY_TYPE_TEST, KEY_TYPE_TEAM, KEY_TYPE_NORMAL)
from notifications_utils.recipients import allowed_to_send_to
from app.dao.notifications_dao import get_financial_year
from datetime import datetime