mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
added force_hide_sender
This commit is contained in:
@@ -470,7 +470,7 @@ def send_one_off_step(service_id, template_id, step_index):
|
||||
)
|
||||
|
||||
|
||||
def _check_messages(service_id, template_id, upload_id, preview_row):
|
||||
def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
|
||||
try:
|
||||
# The happy path is that the job doesn’t already exist, so the
|
||||
# API will return a 404 and the client will raise HTTPError.
|
||||
@@ -510,11 +510,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
|
||||
show_recipient=False,
|
||||
email_reply_to=email_reply_to,
|
||||
sms_sender=sms_sender,
|
||||
)
|
||||
simplifed_template = get_template(
|
||||
db_template,
|
||||
current_service,
|
||||
show_recipient=False,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
allow_list = []
|
||||
@@ -535,7 +531,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
|
||||
allow_list = None
|
||||
recipients = RecipientCSV(
|
||||
contents,
|
||||
template=template or simplifed_template,
|
||||
template=template,
|
||||
max_initial_rows_shown=50,
|
||||
max_errors_shown=50,
|
||||
guestlist=allow_list,
|
||||
@@ -569,9 +565,6 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
|
||||
|
||||
if preview_row < len(recipients) + 2:
|
||||
template.values = recipients[preview_row - 2].recipient_and_personalisation
|
||||
simplifed_template.values = recipients[
|
||||
preview_row - 2
|
||||
].recipient_and_personalisation
|
||||
elif preview_row > 2:
|
||||
abort(404)
|
||||
|
||||
@@ -599,7 +592,6 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
|
||||
service_id, template.id, db_template["version"], original_file_name
|
||||
),
|
||||
template_id=template_id,
|
||||
simplifed_template=simplifed_template,
|
||||
)
|
||||
|
||||
|
||||
@@ -658,7 +650,7 @@ def check_messages(service_id, template_id, upload_id, row_index=2):
|
||||
@user_has_permissions("send_messages", restrict_admin_usage=True)
|
||||
def preview_job(service_id, template_id, upload_id, row_index=2):
|
||||
session["scheduled_for"] = request.form.get("scheduled_for", "")
|
||||
data = _check_messages(service_id, template_id, upload_id, row_index)
|
||||
data = _check_messages(service_id, template_id, upload_id, row_index, force_hide_sender=True)
|
||||
|
||||
return render_template(
|
||||
"views/check/preview.html",
|
||||
@@ -825,11 +817,11 @@ def send_one_off_to_myself(service_id, template_id):
|
||||
def check_notification(service_id, template_id):
|
||||
return render_template(
|
||||
"views/notifications/check.html",
|
||||
**_check_notification(service_id, template_id),
|
||||
**_check_notification(service_id, template_id, show_recipient=True),
|
||||
)
|
||||
|
||||
|
||||
def _check_notification(service_id, template_id, exception=None):
|
||||
def _check_notification(service_id, template_id, exception=None, **kwargs):
|
||||
db_template = current_service.get_template_with_user_permission_or_403(
|
||||
template_id, current_user
|
||||
)
|
||||
@@ -842,13 +834,9 @@ def _check_notification(service_id, template_id, exception=None):
|
||||
template = get_template(
|
||||
db_template,
|
||||
current_service,
|
||||
show_recipient=True,
|
||||
email_reply_to=email_reply_to,
|
||||
sms_sender=sms_sender,
|
||||
)
|
||||
simplifed_template = get_template(
|
||||
db_template,
|
||||
current_service,
|
||||
**kwargs,
|
||||
)
|
||||
placeholders = fields_to_fill_in(template)
|
||||
|
||||
@@ -874,7 +862,6 @@ def _check_notification(service_id, template_id, exception=None):
|
||||
back_link_from_preview=back_link_from_preview,
|
||||
choose_time_form=choose_time_form,
|
||||
**(get_template_error_dict(exception) if exception else {}),
|
||||
simplifed_template=simplifed_template,
|
||||
)
|
||||
|
||||
|
||||
@@ -924,7 +911,7 @@ def preview_notification(service_id, template_id):
|
||||
|
||||
return render_template(
|
||||
"views/notifications/preview.html",
|
||||
**_check_notification(service_id, template_id),
|
||||
**_check_notification(service_id, template_id, show_recipient=False, force_hide_sender=True),
|
||||
scheduled_for=session["scheduled_for"],
|
||||
recipient=recipient,
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<h2 id="{{ file_contents_header_id }}">Message</h2>
|
||||
<div class="preview-message"> {{ simplifed_template|string }}</div>
|
||||
<div class="preview-message"> {{ template|string }}</div>
|
||||
{% if not request.args.from_test %}
|
||||
<h2>Recipients list</h2>
|
||||
<div>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
|
||||
<h2 id="{{ file_contents_header_id }}">Message</h2>
|
||||
<div class="preview-message"> {{ simplifed_template|string }}</div>
|
||||
<div class="preview-message"> {{ template|string }}</div>
|
||||
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
<form method="post" enctype="multipart/form-data" action="{{url_for(
|
||||
|
||||
@@ -17,6 +17,7 @@ def get_template(
|
||||
redact_missing_personalisation=False,
|
||||
email_reply_to=None,
|
||||
sms_sender=None,
|
||||
force_hide_sender=False
|
||||
):
|
||||
if "email" == template["template_type"]:
|
||||
return EmailPreviewTemplate(
|
||||
@@ -33,7 +34,7 @@ def get_template(
|
||||
prefix=service.name,
|
||||
show_prefix=service.prefix_sms,
|
||||
sender=sms_sender,
|
||||
show_sender=bool(sms_sender),
|
||||
show_sender=bool(sms_sender) and not force_hide_sender,
|
||||
show_recipient=show_recipient,
|
||||
redact_missing_personalisation=redact_missing_personalisation,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user