mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 13:09:49 -04:00
Redirect from normal dashboard to broadcast dashboard
There are lots of places where we redirect people to the dashboard, for example after logging in. Rather than add logic to all these places to check for the broadcast permission, let’s just redirect from the normal dashboard to the broadcast dashboard. Other places like the main navigation can still link directly to the broadcast dashboard, where we do care about speed and not going through multiple redirect jumps.
This commit is contained in:
@@ -52,6 +52,9 @@ def service_dashboard(service_id):
|
||||
session.pop('invited_user', None)
|
||||
session['service_id'] = service_id
|
||||
|
||||
if current_service.has_permission('broadcast'):
|
||||
return redirect(url_for('main.broadcast_dashboard', service_id=service_id))
|
||||
|
||||
if not current_user.has_permissions('view_activity'):
|
||||
return redirect(url_for('main.choose_template', service_id=service_id))
|
||||
|
||||
|
||||
@@ -26,6 +26,22 @@ def test_broadcast_pages_403_without_permission(
|
||||
)
|
||||
|
||||
|
||||
def test_dashboard_redirects_to_broadcast_dashboard(
|
||||
client_request,
|
||||
service_one,
|
||||
):
|
||||
service_one['permissions'] += ['broadcast']
|
||||
client_request.get(
|
||||
'.service_dashboard',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_expected_redirect=url_for(
|
||||
'.broadcast_dashboard',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_external=True,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
def test_broadcast_dashboard(
|
||||
client_request,
|
||||
service_one,
|
||||
|
||||
Reference in New Issue
Block a user