mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Use new properties of utils Templates
We’ve added some new properties to the templates in utils that we can use instead of doing weird things like `WithSubjectTemplate.__str__(another_instance)`
This commit is contained in:
@@ -4,7 +4,6 @@ from flask import (
|
||||
request,
|
||||
current_app
|
||||
)
|
||||
from notifications_utils.template import WithSubjectTemplate
|
||||
|
||||
from app import api_user, authenticated_service
|
||||
from app.config import QueueNames
|
||||
@@ -151,13 +150,11 @@ def send_notification(notification_type):
|
||||
def get_notification_return_data(notification_id, notification, template):
|
||||
output = {
|
||||
'template_version': notification['template_version'],
|
||||
'notification': {'id': notification_id}
|
||||
'notification': {'id': notification_id},
|
||||
'body': template.content_with_placeholders_filled_in,
|
||||
}
|
||||
|
||||
if template.template_type == SMS_TYPE:
|
||||
output['body'] = str(template)
|
||||
else:
|
||||
output['body'] = WithSubjectTemplate.__str__(template)
|
||||
if hasattr(template, 'subject'):
|
||||
output['subject'] = template.subject
|
||||
|
||||
return output
|
||||
|
||||
Reference in New Issue
Block a user