diff --git a/app/main/forms.py b/app/main/forms.py index cb2eabcb7..85639dfa7 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -48,6 +48,7 @@ from app.main.validators import ( ValidEmail, ValidGovEmail, ) +from app.models.feedback import PROBLEM_TICKET_TYPE, QUESTION_TICKET_TYPE from app.models.organisation import Organisation from app.models.roles_and_permissions import permissions, roles from app.utils import guess_name_from_email_address @@ -885,8 +886,8 @@ class SupportType(StripWhitespaceForm): support_type = RadioField( 'How can we help you?', choices=[ - ('report-problem', 'Report a problem'), - ('ask-question-give-feedback', 'Ask a question or give feedback'), + (PROBLEM_TICKET_TYPE, 'Report a problem'), + (QUESTION_TICKET_TYPE, 'Ask a question or give feedback'), ], validators=[DataRequired()] ) diff --git a/app/main/views/feedback.py b/app/main/views/feedback.py index 843d3f802..f28fefaee 100644 --- a/app/main/views/feedback.py +++ b/app/main/views/feedback.py @@ -13,9 +13,7 @@ from app.main.forms import ( SupportType, Triage, ) - -QUESTION_TICKET_TYPE = 'ask-question-give-feedback' -PROBLEM_TICKET_TYPE = "report-problem" +from app.models.feedback import PROBLEM_TICKET_TYPE def get_prefilled_message(): diff --git a/app/main/views/index.py b/app/main/views/index.py index 13effe361..86c244d6f 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -15,12 +15,12 @@ from notifications_utils.template import HTMLEmailTemplate, LetterImageTemplate from app import email_branding_client, letter_branding_client, status_api_client from app.main import main from app.main.forms import FieldWithNoneOption, SearchByNameForm -from app.main.views.feedback import QUESTION_TICKET_TYPE from app.main.views.sub_navigation_dictionaries import ( features_nav, pricing_nav, using_notify_nav, ) +from app.models.feedback import QUESTION_TICKET_TYPE from app.utils import get_logo_cdn_domain diff --git a/app/models/feedback.py b/app/models/feedback.py new file mode 100644 index 000000000..fffbf0a29 --- /dev/null +++ b/app/models/feedback.py @@ -0,0 +1,2 @@ +QUESTION_TICKET_TYPE = 'ask-question-give-feedback' +PROBLEM_TICKET_TYPE = 'report-problem' diff --git a/app/url_converters.py b/app/url_converters.py index bee034727..aa2b5dabe 100644 --- a/app/url_converters.py +++ b/app/url_converters.py @@ -1,5 +1,7 @@ from werkzeug.routing import BaseConverter +from app.models.feedback import PROBLEM_TICKET_TYPE, QUESTION_TICKET_TYPE + class TemplateTypeConverter(BaseConverter): @@ -8,7 +10,7 @@ class TemplateTypeConverter(BaseConverter): class TicketTypeConverter(BaseConverter): - regex = '(?:ask-question-give-feedback|report-problem)' + regex = f'(?:{PROBLEM_TICKET_TYPE}|{QUESTION_TICKET_TYPE})' class LetterFileExtensionConverter(BaseConverter): diff --git a/tests/app/main/views/test_feedback.py b/tests/app/main/views/test_feedback.py index b7250be42..cfe649ab7 100644 --- a/tests/app/main/views/test_feedback.py +++ b/tests/app/main/views/test_feedback.py @@ -6,12 +6,8 @@ from bs4 import BeautifulSoup, element from flask import url_for from freezegun import freeze_time -from app.main.views.feedback import ( - PROBLEM_TICKET_TYPE, - QUESTION_TICKET_TYPE, - has_live_services, - in_business_hours, -) +from app.main.views.feedback import has_live_services, in_business_hours +from app.models.feedback import PROBLEM_TICKET_TYPE, QUESTION_TICKET_TYPE from tests.conftest import normalize_spaces