mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Two new methods needed to pass the service not the service ID into the create notifications methods.
This commit is contained in:
@@ -10,7 +10,7 @@ from app.dao.invited_user_dao import (
|
|||||||
get_invited_users_for_service
|
get_invited_users_for_service
|
||||||
)
|
)
|
||||||
from app.dao.templates_dao import dao_get_template_by_id
|
from app.dao.templates_dao import dao_get_template_by_id
|
||||||
from app.models import EMAIL_TYPE, KEY_TYPE_NORMAL
|
from app.models import EMAIL_TYPE, KEY_TYPE_NORMAL, Service
|
||||||
from app.notifications.process_notifications import persist_notification, send_notification_to_queue
|
from app.notifications.process_notifications import persist_notification, send_notification_to_queue
|
||||||
from app.schemas import invited_user_schema
|
from app.schemas import invited_user_schema
|
||||||
|
|
||||||
@@ -27,12 +27,13 @@ def create_invited_user(service_id):
|
|||||||
save_invited_user(invited_user)
|
save_invited_user(invited_user)
|
||||||
|
|
||||||
template = dao_get_template_by_id(current_app.config['INVITATION_EMAIL_TEMPLATE_ID'])
|
template = dao_get_template_by_id(current_app.config['INVITATION_EMAIL_TEMPLATE_ID'])
|
||||||
|
service = Service.query.get(current_app.config['NOTIFY_SERVICE_ID'])
|
||||||
|
|
||||||
saved_notification = persist_notification(
|
saved_notification = persist_notification(
|
||||||
template_id=template.id,
|
template_id=template.id,
|
||||||
template_version=template.version,
|
template_version=template.version,
|
||||||
recipient=invited_user.email_address,
|
recipient=invited_user.email_address,
|
||||||
service_id=current_app.config['NOTIFY_SERVICE_ID'],
|
service=service,
|
||||||
personalisation={
|
personalisation={
|
||||||
'user_name': invited_user.from_user.name,
|
'user_name': invited_user.from_user.name,
|
||||||
'service_name': invited_user.service.name,
|
'service_name': invited_user.service.name,
|
||||||
|
|||||||
@@ -220,12 +220,13 @@ def send_user_email_verification(user_id):
|
|||||||
def send_already_registered_email(user_id):
|
def send_already_registered_email(user_id):
|
||||||
to, errors = email_data_request_schema.load(request.get_json())
|
to, errors = email_data_request_schema.load(request.get_json())
|
||||||
template = dao_get_template_by_id(current_app.config['ALREADY_REGISTERED_EMAIL_TEMPLATE_ID'])
|
template = dao_get_template_by_id(current_app.config['ALREADY_REGISTERED_EMAIL_TEMPLATE_ID'])
|
||||||
|
service = Service.query.get(current_app.config['NOTIFY_SERVICE_ID'])
|
||||||
|
|
||||||
saved_notification = persist_notification(
|
saved_notification = persist_notification(
|
||||||
template_id=template.id,
|
template_id=template.id,
|
||||||
template_version=template.version,
|
template_version=template.version,
|
||||||
recipient=to['email'],
|
recipient=to['email'],
|
||||||
service_id=current_app.config['NOTIFY_SERVICE_ID'],
|
service=service,
|
||||||
personalisation={
|
personalisation={
|
||||||
'signin_url': current_app.config['ADMIN_BASE_URL'] + '/sign-in',
|
'signin_url': current_app.config['ADMIN_BASE_URL'] + '/sign-in',
|
||||||
'forgot_password_url': current_app.config['ADMIN_BASE_URL'] + '/forgot-password',
|
'forgot_password_url': current_app.config['ADMIN_BASE_URL'] + '/forgot-password',
|
||||||
@@ -283,12 +284,12 @@ def send_user_reset_password():
|
|||||||
user_to_send_to = get_user_by_email(email['email'])
|
user_to_send_to = get_user_by_email(email['email'])
|
||||||
|
|
||||||
template = dao_get_template_by_id(current_app.config['PASSWORD_RESET_TEMPLATE_ID'])
|
template = dao_get_template_by_id(current_app.config['PASSWORD_RESET_TEMPLATE_ID'])
|
||||||
|
service = Service.query.get(current_app.config['NOTIFY_SERVICE_ID'])
|
||||||
saved_notification = persist_notification(
|
saved_notification = persist_notification(
|
||||||
template_id=template.id,
|
template_id=template.id,
|
||||||
template_version=template.version,
|
template_version=template.version,
|
||||||
recipient=email['email'],
|
recipient=email['email'],
|
||||||
service_id=current_app.config['NOTIFY_SERVICE_ID'],
|
service=service,
|
||||||
personalisation={
|
personalisation={
|
||||||
'user_name': user_to_send_to.name,
|
'user_name': user_to_send_to.name,
|
||||||
'url': _create_reset_password_url(user_to_send_to.email_address)
|
'url': _create_reset_password_url(user_to_send_to.email_address)
|
||||||
|
|||||||
Reference in New Issue
Block a user