merge from main

This commit is contained in:
Kenneth Kehl
2024-07-23 07:20:05 -07:00
38 changed files with 2187 additions and 1292 deletions

View File

@@ -368,11 +368,23 @@ def make_session_permanent():
def create_beta_url(url):
url_created = urlparse(url)
url_list = list(url_created)
url_list[1] = "beta.notify.gov"
url_for_redirect = urlunparse(url_list)
return url_for_redirect
url_created = None
try:
url_created = urlparse(url)
url_list = list(url_created)
url_list[1] = "beta.notify.gov"
url_for_redirect = urlunparse(url_list)
return url_for_redirect
except ValueError:
# This might be happening due to IPv6, see issue # 1395.
# If we see "'RequestContext' object has no attribute 'service'" in the logs
# we can search around that timestamp and find this output, hopefully.
# It may be sufficient to just catch and log, and prevent the stack trace from being in the logs
# but we need to confirm the root cause first.
current_app.logger.error(
f"create_beta_url orig_url: {url} \
url_created = {str(url_created)} url_for_redirect {str(url_for_redirect)}"
)
def redirect_notify_to_beta():
@@ -380,6 +392,7 @@ def redirect_notify_to_beta():
current_app.config["NOTIFY_ENVIRONMENT"] == "production"
and "beta.notify.gov" not in request.url
):
# TODO add debug here to trace what is going on with the URL for the 'RequestContext' error
url_to_beta = create_beta_url(request.url)
return redirect(url_to_beta, 302)

View File

@@ -105,6 +105,8 @@ def service_dashboard(service_id):
".view_job", service_id=current_service.id, job_id=job["id"]
),
"created_at": job["created_at"],
"processing_finished": job["processing_finished"],
"processing_started": job["processing_started"],
"notification_count": job["notification_count"],
"created_by": job["created_by"],
"notifications": aggregate_notifications_by_job.get(job["id"], []),

View File

@@ -1053,8 +1053,13 @@ def get_email_reply_to_address_from_session():
def get_sms_sender_from_session():
if session.get("sender_id"):
return current_service.get_sms_sender(session["sender_id"])["sms_sender"]
sender_id = session.get("sender_id")
if sender_id:
sms_sender = current_service.get_sms_sender(session["sender_id"])["sms_sender"]
current_app.logger.info(f"SMS Sender ({sender_id}) #: {sms_sender}")
return sms_sender
else:
current_app.logger.error("No SMS Sender!!!!!!")
def get_spreadsheet_column_headings_from_template(template):

View File

@@ -65,6 +65,7 @@ class NotifyAdminAPIClient(BaseAPIClient):
or "user/email" in arg
or "/activate" in arg
or "/email-code" in arg
or "/verify/code" in arg
):
still_signing_in = True
@@ -79,7 +80,7 @@ class NotifyAdminAPIClient(BaseAPIClient):
# we are not full signed in yet
pass
elif not current_user or not current_user.is_active:
current_app.logger.error(f"WHY FAILING {args}")
current_app.logger.error(f"Unauthorized URL #notify-compliance-46 {args}")
abort(403)
def post(self, *args, **kwargs):

View File

@@ -38,7 +38,7 @@
<div class="logo-img display-flex">
<a href="/">
<span class="usa-sr-only">Notify.gov logo</span>
<img src="{{ (asset_path | default('/static')) + 'images/notify-logo.png' }}" alt="Notify.gov logo" class="usa-flag-logo margin-right-1">
<img src="{{ (asset_path | default('/static')) + 'images/notify-logo.svg' }}" alt="Notify.gov logo" class="usa-flag-logo margin-right-1">
</a>
</div>

View File

@@ -37,7 +37,9 @@
<div class="usa-alert__body">
<h4 class="usa-alert__heading">Your text has been sent</h4>
<p class="usa-alert__text">
{{ job.template_name }} - {{ current_service.name }} was sent on {{ job.created_at|format_datetime_normal }} by {{ job.created_by.name }}
{{ job.template_name }} - {{ current_service.name }} was sent on {% if job.processing_started %}
{{ job.processing_started|format_datetime_table }} {% else %}
{{ job.created_at|format_datetime_table }} {% endif %} by {{ job.created_by.name }}
</p>
</div>
</div>

View File

@@ -41,7 +41,7 @@
<span>Template</span>
</th>
<th scope="col" class="table-field-heading">
<span>Time sent</span>
<span>Job status</span>
</th>
<th scope="col" class="table-field-heading">
<span>Sender</span>
@@ -69,7 +69,8 @@
{{ notification.template.name }}
</td>
<td class="table-field time-sent">
{{ job.created_at | format_datetime_table }}
{{ (job.processing_finished if job.processing_finished else job.processing_started
if job.processing_started else job.created_at)|format_datetime_table }}
</td>
<td class="table-field sender">
{{ notification.created_by.name }}