Merge branch 'main' of https://github.com/GSA/notifications-admin into 1250-login-gov-add-new-user

This commit is contained in:
Jonathan Bobel
2024-03-14 13:18:39 -04:00
10 changed files with 55 additions and 29 deletions

View File

@@ -54,6 +54,7 @@ jobs:
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
NR_BROWSER_KEY: ${{ secrets.NR_BROWSER_KEY }}
COMMIT_HASH: $(git rev-parse --short "$GITHUB_SHA")
LOGIN_PEM: ${{ secrets.LOGIN_PEM }}
LOGIN_DOT_GOV_CLIENT_ID: "urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov"
LOGIN_DOT_GOV_USER_INFO_URL: "https://secure.login.gov/api/openid_connect/userinfo"

View File

@@ -54,6 +54,7 @@ jobs:
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
NR_BROWSER_KEY: ${{ secrets.NR_BROWSER_KEY }}
COMMIT_HASH: $(git rev-parse --short "$GITHUB_SHA")
LOGIN_PEM: ${{ secrets.LOGIN_PEM }}
LOGIN_DOT_GOV_CLIENT_ID: "urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov"
LOGIN_DOT_GOV_USER_INFO_URL: "https://secure.login.gov/api/openid_connect/userinfo"

View File

@@ -60,6 +60,7 @@ jobs:
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
NR_BROWSER_KEY: ${{ secrets.NR_BROWSER_KEY }}
COMMIT_HASH: $(git rev-parse --short "$GITHUB_SHA")
LOGIN_PEM: ${{ secrets.LOGIN_PEM }}
LOGIN_DOT_GOV_CLIENT_ID: "urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov"
LOGIN_DOT_GOV_USER_INFO_URL: "https://secure.login.gov/api/openid_connect/userinfo"
@@ -81,6 +82,7 @@ jobs:
--var ADMIN_CLIENT_SECRET="$ADMIN_CLIENT_SECRET"
--var NEW_RELIC_LICENSE_KEY="$NEW_RELIC_LICENSE_KEY"
--var NR_BROWSER_KEY="$NR_BROWSER_KEY"
--var COMMIT_HASH="$COMMIT_HASH"
--var LOGIN_PEM="$LOGIN_PEM"
--var LOGIN_DOT_GOV_CLIENT_ID="$LOGIN_DOT_GOV_CLIENT_ID"
--var LOGIN_DOT_GOV_USER_INFO_URL="$LOGIN_DOT_GOV_USER_INFO_URL"

View File

@@ -36,6 +36,7 @@ class Config(object):
NR_BROWSER_KEY = getenv("NR_BROWSER_KEY")
settings = newrelic.agent.global_settings()
NR_MONITOR_ON = settings and settings.monitor_mode
COMMIT_HASH = getenv("COMMIT_HASH", "-----")
TEMPLATE_PREVIEW_API_HOST = getenv(
"TEMPLATE_PREVIEW_API_HOST", "http://localhost:9999"

View File

@@ -1,4 +1,3 @@
import itertools
import time
import uuid
from string import ascii_uppercase
@@ -517,19 +516,27 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
current_service,
show_recipient=False,
)
allow_list = []
if current_service.trial_mode:
# Adding the simulated numbers to allow list
# so they can be sent in trial mode
for user in Users(service_id):
allow_list.extend([user.name, user.mobile_number, user.email_address])
# Failed sms number
allow_list.extend(["simulated user (fail)", "+14254147167", "simulated@simulated.gov"])
# Success sms number
allow_list.extend(
["simulated user (success)", "+14254147755", "simulatedtwo@simulated.gov"]
)
else:
allow_list = None
recipients = RecipientCSV(
contents,
template=template or simplifed_template,
max_initial_rows_shown=50,
max_errors_shown=50,
guestlist=(
itertools.chain.from_iterable(
[user.name, user.mobile_number, user.email_address]
for user in Users(service_id)
)
if current_service.trial_mode
else None
),
guestlist=allow_list,
remaining_messages=remaining_messages,
allow_international_sms=current_service.has_permission("international_sms"),
)
@@ -560,7 +567,9 @@ 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
simplifed_template.values = recipients[
preview_row - 2
].recipient_and_personalisation
elif preview_row > 2:
abort(404)
@@ -863,7 +872,7 @@ 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
simplifed_template=simplifed_template,
)

View File

@@ -179,7 +179,9 @@
{% if current_service and current_service.research_mode %}
{% set meta_suffix = 'Built by the <a href="https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/tts-solutions" class="usa-link">Technology Transformation Services</a><span id="research-mode" class="research-mode">research mode</span>' %}
{% else %}
{% set meta_suffix = 'Built by the <a href="https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/tts-solutions" class="usa-link">Technology Transformation Services</a>' %}
{% set commit_hash = ", Latest version: " + config['COMMIT_HASH'] %}
{% set long_link = '<a href="https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/tts-solutions" class="usa-link">Technology Transformation Services</a>' %}
{% set meta_suffix = "Built by the " + long_link + commit_hash %}
{% endif %}
{{ usaFooter({
@@ -240,7 +242,7 @@
{
"href": url_for('main.support'),
"text": "Contact us"
},
}
]
},
],

View File

@@ -41,7 +41,7 @@
<h3>To create and format your message</h3>
<ol class="list">
<li>All messages start from a template</li>
<li>Click <a href={{ url_for('.choose_template', service_id=current_service.id) }}>Send Messages</a>. Youll see existing templates.</li>
<li>Click "<a href={{ url_for('.choose_template', service_id=current_service.id) }}>Send Messages</a>". You'll see existing templates.</li>
<li>Add a new template or choose an existing template and select Edit.</li>
</ol>
@@ -69,7 +69,7 @@
<h2 class="padding-top-1" id="personalize-content">Personalize your content</h2>
<p>Personalizing your content can increase response rates and help the recipient know the text is legitimate.</p>
<ul class="list list-bullet">
<li>Including a persons first name increases response rates.</li>
<li>Including a person's first name increases response rates.</li>
<li>Specific details such as time and location of an appointment or where suspected fraud use occurred encourages action.</li>
</ul>
@@ -82,7 +82,10 @@
<h4>Example</h4>
<p>To personalize with the recipient's first name and include a reference number:</p>
<p class="padding-2 bg-base-lightest">State WIC: Hello ((first name)), your reference is ((ref number)). Please provide this number when you call 123-123-1234 to make an appointment.</p>
<p class="padding-2 bg-base-lightest">State WIC: Hello ((first name)), your reference is ((ref number)). Please provide this number when you call 555-123-1234 to make an appointment.</p>
<p>Note that variations in the length of personalized content can impact the length of specific messages, and may affect
the number of parts used.</p>
{# Add conditional content #}
<h2 class="padding-top-1" id="conditional-content">Add conditional content</h2>
@@ -106,7 +109,7 @@
<li>
If you want to make people who are homebound aware of the option of virtual visits (but not other message recipients):
</br>
<p class="padding-2 bg-base-lightest">State Medicaid: Please call 123-123-1234 to schedule an appointment. ((homebound??Virtual visits are available.))</p>
<p class="padding-2 bg-base-lightest">State Medicaid: Please call 555-123-1234 to schedule an appointment. ((homebound??Virtual visits are available.))</p>
</li>
<li>
If you want to send a messages in different languages to different recipients:
@@ -231,7 +234,7 @@
</li>
<li>Auto-response text:
</br>
<p class="padding-2 bg-base-lightest">State Agency: This number is unmonitored. To contact us, call us at 123-123-1234. We will never ask for personal details
<p class="padding-2 bg-base-lightest">State Agency: This number is unmonitored. To contact us, call us at 555-123-1234. We will never ask for personal details
in a text. If you have questions about how to protect your privacy, see statename.gov/privacy.</p>
</li>
</ol>

View File

@@ -6,16 +6,16 @@
{% extends "content_template.html" %}
{% block per_page_title %}
Pricing
Message parts
{% endblock %}
{% block content_column_content %}
<h1 class="font-body-2xl margin-bottom-3">Pricing</h1>
<h1 class="font-body-2xl margin-bottom-3">Message parts</h1>
{{ content_metadata(
data={
"Last updated": "January 25, 2024"
"Last updated": "February 5, 2024"
}
) }}
@@ -30,7 +30,8 @@ more parts towards the allowance if you:</p>
</ul>
<h3 class="font-body-lg" id="long-text-messages">Long text messages</h3>
<p>If a text message is longer than 160 characters (including spaces), it counts as more than one message part.</p>
<p>If a text message is longer than 160 characters (including spaces and service name), it counts as more than one message
part.</p>
<div class="bottom-gutter-3-2">
{% call mapping_table(
@@ -55,6 +56,13 @@ more parts towards the allowance if you:</p>
{% endcall %}
</div>
<h3 class="font-body-lg" id="Personalization">Personalization</h3>
<p>Personalization can change the length of messages. For example, if you are personalizing with a first name, Fred is
significantly shorter than Alexander. When you are evaluating how long a message is, you need to consider variations in
message length based on personalization.</p>
<p>Before you send messages, Notify will let you know how many messages you are sending, the number of parts you are using,
and the number of parts youll have left.</p>
<h3 class="font-body-lg" id="symbols">Signs and symbols</h3>
<p>
@@ -158,9 +166,4 @@ more parts towards the allowance if you:</p>
{% endcall %}
</div>
<h3 class="font-body-lg" id="international-numbers">Trial mode</h3>
<p>When a new service is added, it will start in <a href="/using-notify/trial-mode">trial mode</a>. Moving a service out of trial mode is subject to approval by
the Notify.gov team. Additional unique services may be added, although moving each service out of trial mode is subject
to approval by the Notify.gov team.</p>
{% endblock %}

View File

@@ -47,6 +47,8 @@ applications:
REQUESTS_CA_BUNDLE: "/etc/ssl/certs/ca-certificates.crt"
NEW_RELIC_CA_BUNDLE_PATH: "/etc/ssl/certs/ca-certificates.crt"
COMMIT_HASH: ((COMMIT_HASH))
# login.gov variables
LOGIN_PEM: ((LOGIN_PEM))

View File

@@ -2612,8 +2612,10 @@ def test_preview_notification_shows_preview(
session["placeholders"] = {}
page = client_request.post(
"main.preview_notification", service_id=service_one["id"], template_id=fake_uuid,
_expected_status=200
"main.preview_notification",
service_id=service_one["id"],
template_id=fake_uuid,
_expected_status=200,
)
assert page.h1.text.strip() == "Preview"
assert (page.find_all("a", {"class": "usa-back-link"})[0]["href"]) == url_for(