diff --git a/app/main/views/organisations.py b/app/main/views/organisations.py
index 44d4c068d..78ebfec2d 100644
--- a/app/main/views/organisations.py
+++ b/app/main/views/organisations.py
@@ -70,13 +70,8 @@ def add_organisation():
@login_required
@user_has_permissions()
def organisation_dashboard(org_id):
- for service in current_organisation.live_services:
- has_permission = current_user.has_permission_for_service(service['id'], 'view_activity')
- service.update({'has_permission_to_view': has_permission})
-
return render_template(
'views/organisations/organisation/index.html',
- organisation_services=current_organisation.live_services
)
@@ -87,7 +82,6 @@ def organisation_trial_mode_services(org_id):
return render_template(
'views/organisations/organisation/trial-mode-services.html',
search_form=SearchByNameForm(),
- services=current_organisation.trial_services
)
diff --git a/app/templates/views/organisations/organisation/index.html b/app/templates/views/organisations/organisation/index.html
index 1fd844422..c0ae8a5cd 100644
--- a/app/templates/views/organisations/organisation/index.html
+++ b/app/templates/views/organisations/organisation/index.html
@@ -10,13 +10,9 @@
Services
- {% for service in organisation_services %}
+ {% for service in current_org.live_services %}
-
- {% if service.has_permission_to_view or current_user.platform_admin %}
- {{ service['name'] }}
- {% else %}
- {{ service['name'] }}
- {% endif %}
+ {{ service['name'] }}
{% endfor %}
diff --git a/app/templates/views/organisations/organisation/trial-mode-services.html b/app/templates/views/organisations/organisation/trial-mode-services.html
index 74c734c23..5e8d0e1cf 100644
--- a/app/templates/views/organisations/organisation/trial-mode-services.html
+++ b/app/templates/views/organisations/organisation/trial-mode-services.html
@@ -12,7 +12,7 @@
{{ live_search(target_selector='.browse-list-item', show=True, form=search_form, label='Search by name') }}
- {% for service in services %}
+ {% for service in current_org.trial_services %}
-
{{ service['name'] }}
diff --git a/tests/app/main/views/organisations/test_organisation.py b/tests/app/main/views/organisations/test_organisation.py
index cb4fb0bed..634182ec8 100644
--- a/tests/app/main/views/organisations/test_organisation.py
+++ b/tests/app/main/views/organisations/test_organisation.py
@@ -9,6 +9,7 @@ from tests import organisation_json, service_json
from tests.conftest import (
ORGANISATION_ID,
SERVICE_ONE_ID,
+ SERVICE_TWO_ID,
active_user_with_permissions,
normalize_spaces,
platform_admin_user,
@@ -104,11 +105,11 @@ def test_organisation_services_shows_live_services_only(
mocker.patch(
'app.organisations_client.get_organisation_services',
return_value=[
- service_json(id_='1', name='1', restricted=False, active=True), # live
+ service_json(id_=SERVICE_ONE_ID, name='1', restricted=False, active=True), # live
service_json(id_='2', name='2', restricted=True, active=True), # trial
service_json(id_='3', name='3', restricted=True, active=False), # trial, now archived
service_json(id_='4', name='4', restricted=False, active=False), # was live, now archived
- service_json(id_=SERVICE_ONE_ID, name='5', restricted=False, active=True), # live, member of
+ service_json(id_=SERVICE_TWO_ID, name='5', restricted=False, active=True), # live, member of
]
)
@@ -120,8 +121,8 @@ def test_organisation_services_shows_live_services_only(
assert normalize_spaces(services[0].text) == '1'
assert normalize_spaces(services[1].text) == '5'
- assert services[0].find('a') is None
- assert services[1].find('a')['href'] == url_for('main.service_dashboard', service_id=SERVICE_ONE_ID)
+ assert services[0].find('a')['href'] == url_for('main.service_dashboard', service_id=SERVICE_ONE_ID)
+ assert services[1].find('a')['href'] == url_for('main.service_dashboard', service_id=SERVICE_TWO_ID)
def test_organisation_trial_mode_services_shows_all_non_live_services(