mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Allow the admin app to send one-off letters
This commit modifies the code paths the admin app uses to send one off emails and text messages to also accept letters. This mostly worked already, the two changes were: - making sure that one-off letters are processed by the correct task, from the correct queue - one-off letters sent from a service in research mode don’t get put on a queue and go straight to `delivered` (because we don’t want to send them for real)
This commit is contained in:
@@ -12,6 +12,7 @@ from notifications_utils.recipients import (
|
||||
|
||||
from app import redis_store
|
||||
from app.celery import provider_tasks
|
||||
from app.celery.letters_pdf_tasks import create_letters_pdf
|
||||
from app.config import QueueNames
|
||||
|
||||
from app.models import (
|
||||
@@ -149,6 +150,10 @@ def send_notification_to_queue(notification, research_mode, queue=None):
|
||||
if not queue:
|
||||
queue = QueueNames.SEND_EMAIL
|
||||
deliver_task = provider_tasks.deliver_email
|
||||
if notification.notification_type == LETTER_TYPE:
|
||||
if not queue:
|
||||
queue = QueueNames.CREATE_LETTERS_PDF
|
||||
deliver_task = create_letters_pdf
|
||||
|
||||
try:
|
||||
deliver_task.apply_async([str(notification.id)], queue=queue)
|
||||
|
||||
Reference in New Issue
Block a user