mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-27 03:09:11 -04:00
Auto populate the phone number when replying
Currently the only way of ‘replying’ to an inbound message is by copy/pasting the phone number from the inbound page into the send one off page. Rather than making people copy/paste, this commit puts the phone number in the session, if the user is going through the new reply flow.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from flask import (
|
||||
jsonify,
|
||||
session,
|
||||
redirect,
|
||||
render_template,
|
||||
url_for,
|
||||
)
|
||||
@@ -60,9 +62,30 @@ def conversation_reply(
|
||||
show_search_box=(len(templates) > 7),
|
||||
template_type='sms',
|
||||
search_form=SearchTemplatesForm(),
|
||||
notification_id=notification_id,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/conversation/<notification_id>/reply-with/<template_id>")
|
||||
@login_required
|
||||
@user_has_permissions('send_texts', admin_override=True)
|
||||
def conversation_reply_with_template(
|
||||
service_id,
|
||||
notification_id,
|
||||
template_id,
|
||||
):
|
||||
|
||||
session['recipient'] = get_user_number(service_id, notification_id)
|
||||
session['placeholders'] = {'phone number': session['recipient']}
|
||||
|
||||
return redirect(url_for(
|
||||
'main.send_one_off_step',
|
||||
service_id=service_id,
|
||||
template_id=template_id,
|
||||
step_index=1,
|
||||
))
|
||||
|
||||
|
||||
def get_conversation_partials(service_id, user_number):
|
||||
|
||||
return {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
{% for template in templates %}
|
||||
<div class="column-whole">
|
||||
<h2 class="message-name">
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">{{ template.name }}</a>
|
||||
<a href="{{ url_for('.conversation_reply_with_template', service_id=current_service.id, template_id=template.id, notification_id=notification_id) }}">{{ template.name }}</a>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
|
||||
|
||||
Reference in New Issue
Block a user