mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-16 11:23:24 -04:00
Skip template page for users who only send
If you only send messages then there’s no longer much point in the template page. It now, for you, only has one action – ‘Send’. This commit changes the journey for these users so they go straight from clicking the name of the template to the page where you enter the phone number or email address. This is better because it reduces the number of steps a user has to click through to send a message. This journey is what we were previously calling ‘basic view’. But this changes makes it automatically available to anyone who would benefit from it. It removes the complexity of: - having to opt in to basic view at a service level - having to choose on a per-user basis who has basic view - understanding the nuance between basic view and only choosing the ‘Send messages’ permission Users who will still see the template page are: - those who can edit templates – they need the ‘edit’ link - users with the manage API keys permission – they need a place to get the template ID
This commit is contained in:
@@ -48,7 +48,10 @@ page_headings = {
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
def view_template(service_id, template_id):
|
||||
if not current_user.has_permissions('view_activity'):
|
||||
if (
|
||||
current_user.has_permissions('send_messages') and
|
||||
not current_user.has_permissions('manage_templates', 'manage_api_keys')
|
||||
):
|
||||
return redirect(url_for(
|
||||
'.send_one_off', service_id=service_id, template_id=template_id
|
||||
))
|
||||
|
||||
@@ -187,6 +187,32 @@ def test_caseworker_redirected_to_one_off(
|
||||
)
|
||||
|
||||
|
||||
def test_user_with_only_send_and_view_redirected_to_one_off(
|
||||
client_request,
|
||||
mock_get_service_templates,
|
||||
active_user_with_permissions,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
):
|
||||
active_user_with_permissions._permissions[SERVICE_ONE_ID] = [
|
||||
'send_messages',
|
||||
'view_activity',
|
||||
]
|
||||
client_request.login(active_user_with_permissions)
|
||||
client_request.get(
|
||||
'main.view_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
_expected_status=302,
|
||||
_expected_redirect=url_for(
|
||||
'main.send_one_off',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
_external=True,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('permissions, links_to_be_shown, permissions_warning_to_be_shown', [
|
||||
(
|
||||
['view_activity'],
|
||||
@@ -203,11 +229,6 @@ def test_caseworker_redirected_to_one_off(
|
||||
['.edit_service_template'],
|
||||
None,
|
||||
),
|
||||
(
|
||||
['send_messages'],
|
||||
['.set_sender'],
|
||||
None,
|
||||
),
|
||||
(
|
||||
['send_messages', 'manage_templates'],
|
||||
['.set_sender', '.edit_service_template'],
|
||||
|
||||
Reference in New Issue
Block a user