mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Merge branch 'main' into 2109-build-out-architecture-for-new-about-pages-behind-feature-flag
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
from flask import abort, current_app, redirect, render_template, request, url_for
|
||||
from flask import abort, current_app, jsonify, redirect, render_template, request, url_for
|
||||
|
||||
import os
|
||||
import secrets
|
||||
from urllib.parse import unquote
|
||||
|
||||
from flask_login import current_user
|
||||
|
||||
from app import status_api_client
|
||||
@@ -17,19 +22,28 @@ from app.utils.user import user_is_logged_in
|
||||
# Hook to check for feature flags
|
||||
@main.before_request
|
||||
def check_feature_flags():
|
||||
if (
|
||||
request.path.startswith("/guides/best-practices")
|
||||
and not current_app.config.get("FEATURE_BEST_PRACTICES_ENABLED", False)
|
||||
if request.path.startswith("/guides/best-practices") and not current_app.config.get(
|
||||
"FEATURE_BEST_PRACTICES_ENABLED", False
|
||||
):
|
||||
abort(404)
|
||||
|
||||
if (
|
||||
request.path.startswith("/about")
|
||||
and not current_app.config.get("FEATURE_ABOUT_PAGE_ENABLED", False)
|
||||
if request.path.startswith("/about") and not current_app.config.get(
|
||||
"FEATURE_ABOUT_PAGE_ENABLED", False
|
||||
):
|
||||
abort(404)
|
||||
|
||||
|
||||
@main.route("/test/feature-flags")
|
||||
def test_feature_flags():
|
||||
return jsonify(
|
||||
{
|
||||
"FEATURE_BEST_PRACTICES_ENABLED": current_app.config[
|
||||
"FEATURE_BEST_PRACTICES_ENABLED"
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@main.route("/")
|
||||
def index():
|
||||
if current_user and current_user.is_authenticated:
|
||||
@@ -249,6 +263,7 @@ def benchmark_performance():
|
||||
)
|
||||
|
||||
|
||||
@main.route("/using-notify/guidance")
|
||||
@main.route("/guides/using-notify/guidance")
|
||||
@user_is_logged_in
|
||||
def guidance_index():
|
||||
@@ -269,6 +284,22 @@ def about_notify():
|
||||
)
|
||||
|
||||
|
||||
@main.route("/about/security")
|
||||
def about_security():
|
||||
return render_template(
|
||||
"views/about/security.html",
|
||||
navigation_links=about_notify_nav(),
|
||||
)
|
||||
|
||||
|
||||
@main.route("/about/why-text-messaging")
|
||||
def why_text_messaging():
|
||||
return render_template(
|
||||
"views/about/why-text-messaging.html",
|
||||
navigation_links=about_notify_nav(),
|
||||
)
|
||||
|
||||
|
||||
@main.route("/using-notify/guidance/create-and-send-messages")
|
||||
@user_is_logged_in
|
||||
def create_and_send_messages():
|
||||
|
||||
@@ -110,7 +110,31 @@ def best_practices_nav():
|
||||
def about_notify_nav():
|
||||
return [
|
||||
{
|
||||
"name": "About notify",
|
||||
"name": "About Notify",
|
||||
"link": "main.about_notify",
|
||||
"sub_navigation_items": [
|
||||
{
|
||||
"name": "Why text messaging",
|
||||
"link": "main.why_text_messaging",
|
||||
"sub_sub_navigation_items": [
|
||||
{
|
||||
"name": "Reach people using a common method",
|
||||
"link": "main.why_text_messaging#reach-people-using-a-common-method",
|
||||
},
|
||||
{
|
||||
"name": "Improve customer experience",
|
||||
"link": "main.why_text_messaging#improve-customer-experience",
|
||||
},
|
||||
{
|
||||
"name": "What texting is best for",
|
||||
"link": "main.why_text_messaging#what-texting-is-best-for",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Security",
|
||||
"link": "main.about_security",
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user