mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Add a page to pick a template to reply with
If your service is receiving inbound messages, you might want to reply to them. Without an API integration, the only way to do this is by doing the send one off flow. But currently there is no direct link from the page which shows the inbound messages. So this commit: - adds a link to a new page… - …which shows the available (ie only text message) templates with which you can reply
This commit is contained in:
@@ -7,6 +7,7 @@ from flask_login import login_required
|
||||
from notifications_utils.recipients import format_phone_number_human_readable
|
||||
from notifications_utils.template import SMSPreviewTemplate
|
||||
from app.main import main
|
||||
from app.main.forms import SearchTemplatesForm
|
||||
from app.utils import user_has_permissions
|
||||
from app import notification_api_client, service_api_client
|
||||
from notifications_python_client.errors import HTTPError
|
||||
@@ -24,6 +25,7 @@ def conversation(service_id, notification_id):
|
||||
user_number=user_number,
|
||||
partials=get_conversation_partials(service_id, user_number),
|
||||
updates_url=url_for('.conversation_updates', service_id=service_id, notification_id=notification_id),
|
||||
notification_id=notification_id,
|
||||
)
|
||||
|
||||
|
||||
@@ -38,6 +40,29 @@ def conversation_updates(service_id, notification_id):
|
||||
))
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/conversation/<notification_id>/reply-with")
|
||||
@login_required
|
||||
@user_has_permissions('send_texts', admin_override=True)
|
||||
def conversation_reply(
|
||||
service_id,
|
||||
notification_id,
|
||||
):
|
||||
|
||||
templates = [
|
||||
template
|
||||
for template in service_api_client.get_service_templates(service_id)['data']
|
||||
if template['template_type'] == 'sms'
|
||||
]
|
||||
|
||||
return render_template(
|
||||
'views/templates/choose-reply.html',
|
||||
templates=templates,
|
||||
show_search_box=(len(templates) > 7),
|
||||
template_type='sms',
|
||||
search_form=SearchTemplatesForm(),
|
||||
)
|
||||
|
||||
|
||||
def get_conversation_partials(service_id, user_number):
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user