mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-02 17:48:50 -04:00
Add a specific route for template_type=all
`all` is not a real template type, so for links to template folders that apply to all template types we have a URL that looks like: ``` /services/<uuid:service_id>/templates ``` However Flask only generates this url when `url_for` is called with `template_type=None`. If called with `template_type=all` then Flask will generate a URL like ``` /services/<uuid:service_id>/templates/all ``` However attempting to load this URL will now 404, since `all` is not a template type recognised by the regex introduced in https://github.com/alphagov/notifications-admin/pull/3176 It would be nice to not have URLs with `all` in them at all, but since people might have bookmarked them we need to support them indefinitely. Also considered but decided against adding `all` to the set of template types because it might cause other problems, for example attempting to create a new template with a type of `all` would never work.
This commit is contained in:
@@ -422,7 +422,7 @@ def format_decorators(decorators, indent=8):
|
||||
def test_code_to_extract_decorators_works_with_known_examples():
|
||||
assert (
|
||||
'templates.choose_template',
|
||||
['main.route', 'main.route', 'main.route', 'main.route', 'main.route', 'user_has_permissions'],
|
||||
['main.route', 'main.route', 'main.route', 'main.route', 'main.route', 'main.route', 'user_has_permissions'],
|
||||
) in list(
|
||||
get_routes_and_decorators(SERVICE_ID_ARGUMENT)
|
||||
)
|
||||
|
||||
@@ -95,6 +95,54 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
|
||||
],
|
||||
None,
|
||||
),
|
||||
(
|
||||
'Templates – service one – GOV.UK Notify',
|
||||
'Templates',
|
||||
[],
|
||||
{'template_type': 'all'},
|
||||
['Email', 'Text message', 'Letter'],
|
||||
[
|
||||
'folder_one 2 folders',
|
||||
'folder_one folder_one_one 1 template, 1 folder',
|
||||
'folder_one folder_one_one folder_one_one_one 1 template',
|
||||
'folder_one folder_one_one folder_one_one_one sms_template_nested Text message template',
|
||||
'folder_one folder_one_one letter_template_nested Letter template',
|
||||
'folder_one folder_one_two Empty',
|
||||
'folder_two Empty',
|
||||
'sms_template_one Text message template',
|
||||
'sms_template_two Text message template',
|
||||
'email_template_one Email template',
|
||||
'email_template_two Email template',
|
||||
'letter_template_one Letter template',
|
||||
'letter_template_two Letter template',
|
||||
],
|
||||
[
|
||||
'folder_one 2 folders',
|
||||
'folder_two Empty',
|
||||
'sms_template_one Text message template',
|
||||
'sms_template_two Text message template',
|
||||
'email_template_one Email template',
|
||||
'email_template_two Email template',
|
||||
'letter_template_one Letter template',
|
||||
'letter_template_two Letter template',
|
||||
],
|
||||
[
|
||||
'folder_one',
|
||||
'folder_one_one',
|
||||
'folder_one_one_one',
|
||||
'sms_template_nested',
|
||||
'letter_template_nested',
|
||||
'folder_one_two',
|
||||
'folder_two',
|
||||
'sms_template_one',
|
||||
'sms_template_two',
|
||||
'email_template_one',
|
||||
'email_template_two',
|
||||
'letter_template_one',
|
||||
'letter_template_two',
|
||||
],
|
||||
None,
|
||||
),
|
||||
(
|
||||
'Templates – service one – GOV.UK Notify',
|
||||
'Templates',
|
||||
|
||||
Reference in New Issue
Block a user