From 401da3386a29cb7057572e593a337fcceda19604 Mon Sep 17 00:00:00 2001
From: Mat Moore
Date: Mon, 28 Oct 2024 12:11:53 +0000
Subject: [PATCH] feat: show data custodians if available
I've left data owner in until we have correctly populated the
custodians in Datahub.
---
locale/en/LC_MESSAGES/django.po | 78 ++++++++++---------
templates/details_base.html | 2 +-
templates/partial/contact_info.html | 21 ++++-
tests/conftest.py | 5 +-
.../test_details_contact_contents.py | 56 +++++++------
5 files changed, 97 insertions(+), 65 deletions(-)
diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po
index 740aa234..38c83e05 100644
--- a/locale/en/LC_MESSAGES/django.po
+++ b/locale/en/LC_MESSAGES/django.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Find MoJ data\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-10-22 15:17+0100\n"
+"POT-Creation-Date: 2024-10-28 12:09+0000\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -32,27 +32,27 @@ msgstr "There is a problem with this service"
msgid "Page not found"
msgstr "Page not found"
-#: feedback/models.py:19
+#: feedback/models.py:17
msgid "Satisfaction survey"
msgstr "Satisfaction survey"
-#: feedback/models.py:25
+#: feedback/models.py:23
msgid "How can we improve this service?"
msgstr "How can we improve this service?"
-#: feedback/models.py:45
+#: feedback/models.py:40
msgid "What is wrong with this page?"
msgstr ""
-#: feedback/models.py:50
+#: feedback/models.py:45
msgid "Can you provide more detail?"
msgstr ""
-#: feedback/templates/feedback.html:18 feedback/templates/report_issue.html:23
+#: feedback/templates/feedback.html:18 feedback/templates/report_issue.html:17
msgid "There is a problem"
msgstr "There is a problem"
-#: feedback/templates/feedback.html:21 feedback/templates/report_issue.html:26
+#: feedback/templates/feedback.html:21 feedback/templates/report_issue.html:20
msgid "Make sure you have filled in all the fields."
msgstr "Make sure you have filled in all the fields."
@@ -64,11 +64,11 @@ msgstr ""
"Do not include personal or financial information, like your National "
"Insurance number or credit card details."
-#: feedback/templates/report_issue.html:64
+#: feedback/templates/report_issue.html:58
msgid "Please provide as much information as possible about the issue."
msgstr ""
-#: feedback/templates/thanks.html:9 feedback/views.py:38
+#: feedback/templates/thanks.html:9 feedback/views.py:39
msgid "Thank you for your feedback"
msgstr "Thank you for your feedback"
@@ -76,17 +76,13 @@ msgstr "Thank you for your feedback"
msgid "Your feedback will help us improve the service."
msgstr "Your feedback will help us improve the service."
-#: feedback/views.py:28
+#: feedback/views.py:29
msgid "Give feedback on Find MOJ data"
msgstr "Give feedback on Find MOJ data"
-#: feedback/views.py:64
-msgid "Report an issue with {request.session.get('entity_name')}"
-msgstr ""
-
-#: feedback/views.py:83
-#, python-brace-format
-msgid "Report an issue with {entity_name}"
+#: feedback/views.py:64 feedback/views.py:83
+#, python-format
+msgid "Report an issue with %s"
msgstr ""
#: home/forms/search.py:16
@@ -106,11 +102,11 @@ msgstr "Subject area"
msgid "filter-refresh"
msgstr "selection will trigger the filter and refresh the search results"
-#: home/service/details.py:65 templates/partial/search_result.html:20
+#: home/service/details.py:72 templates/partial/search_result.html:20
msgid "Database"
msgstr "Database"
-#: home/service/details.py:148 templates/partial/search_result.html:24
+#: home/service/details.py:155 templates/partial/search_result.html:24
msgid "Chart"
msgstr "Chart"
@@ -289,8 +285,8 @@ msgstr "Last updated:"
msgid "Domain:"
msgstr "Subject area:"
-#: templates/details_base.html:80 templates/partial/contact_info.html:15
-#: templates/partial/contact_info.html:30
+#: templates/details_base.html:80 templates/partial/contact_info.html:17
+#: templates/partial/contact_info.html:34
#: templates/partial/search_result.html:40
msgid "Not provided"
msgstr "Not provided."
@@ -383,15 +379,15 @@ msgstr ""
"label=\"Learn more about Find MoJ data\" href=\"https://user-guide.find-moj-"
"data.service.justice.gov.uk/\">Learn more"
-#: templates/home.html:43
+#: templates/home.html:44
msgid "Browse by domain"
msgstr "Browse by subject area"
-#: templates/home.html:51
+#: templates/home.html:52
msgid "Help us grow"
msgstr "Help us grow"
-#: templates/home.html:52
+#: templates/home.html:53
msgid ""
"Find MoJ data is a new service with a growing catalogue of data. You can "
"help us improve the service by:"
@@ -399,15 +395,15 @@ msgstr ""
"Find MoJ data is a new service with a growing catalogue of data. You can "
"help us improve the service by:"
-#: templates/home.html:54
+#: templates/home.html:55
msgid "adding a new data source"
msgstr "adding a new data source"
-#: templates/home.html:55
+#: templates/home.html:56
msgid "telling us about data you would like to see"
msgstr "telling us about data you would like to see"
-#: templates/home.html:56
+#: templates/home.html:57
msgid "giving us feedback"
msgstr "giving us feedback"
@@ -420,22 +416,34 @@ msgid "Click link for access information (opens in new tab)"
msgstr "Select this link for access information (opens in new tab)"
#: templates/partial/contact_info.html:13
+msgid "Please contact the data custodian for access information."
+msgstr "Contact the data custodian to request access."
+
+#: templates/partial/contact_info.html:15
msgid "Please contact the data owner for access information."
msgstr "Contact the data owner to request access."
-#: templates/partial/contact_info.html:22
+#: templates/partial/contact_info.html:24
msgid "Contact channels for questions"
msgstr "Ask a question"
-#: templates/partial/contact_info.html:28
+#: templates/partial/contact_info.html:30
+msgid "Contact the data custodian with questions."
+msgstr ""
+
+#: templates/partial/contact_info.html:32
msgid "Contact the data owner with questions."
msgstr "Contact the data owner with questions."
-#: templates/partial/contact_info.html:36
+#: templates/partial/contact_info.html:41
+msgid "Data custodian"
+msgstr "Data custodian (technical contact)"
+
+#: templates/partial/contact_info.html:48
msgid "IAO or Data Owner"
msgstr "Data owner"
-#: templates/partial/contact_info.html:43
+#: templates/partial/contact_info.html:55
msgid ""
"Not provided - contact the Data Catalogue team about "
@@ -557,15 +565,15 @@ msgstr "Remove this filter"
msgid "Sort results"
msgstr "Sort results"
-#: templates/search.html:15
+#: templates/search.html:16
msgid "Search input"
msgstr "Search input"
-#: templates/search.html:28
+#: templates/search.html:29
msgid "Search query tips"
msgstr "Search tips"
-#: templates/search.html:33
+#: templates/search.html:34
#, python-format
msgid ""
" More "
"advanced search options
"
-#: templates/search.html:50
+#: templates/search.html:51
msgid "Some results were malformed and are not shown"
msgstr "Some results were malformed and are not shown"
diff --git a/templates/details_base.html b/templates/details_base.html
index ef59b80a..7463b206 100644
--- a/templates/details_base.html
+++ b/templates/details_base.html
@@ -95,7 +95,7 @@
- {% include "partial/contact_info.html" with entity_name=entity.name data_owner=entity.governance.data_owner.display_name data_owner_email=entity.governance.data_owner.email slack_channel=entity.custom_properties.further_information access_requirements=entity.custom_properties.access_information.dc_access_requirements is_access_url=is_access_requirements_a_url platform=entity.platform %}
+ {% include "partial/contact_info.html" with entity_name=entity.name governance=entity.governance slack_channel=entity.custom_properties.further_information access_requirements=entity.custom_properties.access_information.dc_access_requirements is_access_url=is_access_requirements_a_url platform=entity.platform %}
diff --git a/templates/partial/contact_info.html b/templates/partial/contact_info.html
index ccb0df46..2f62be78 100644
--- a/templates/partial/contact_info.html
+++ b/templates/partial/contact_info.html
@@ -9,7 +9,9 @@ {% translate "Access require
{% else %}
{{ access_requirements }}
{% endif %}
- {% elif data_owner_email %}
+ {% elif governance.data_custodians %}
+ {% translate "Please contact the data custodian for access information." %}
+ {% elif governance.data_owner.email %}
{% translate "Please contact the data owner for access information." %}
{% else %}
{% translate "Not provided" %}
@@ -24,7 +26,9 @@ {% translate "Contact channe
{% if slack_channel.dc_slack_channel_url %}
Slack channel: {{ slack_channel.dc_slack_channel_name }} (opens in new tab)
- {% elif data_owner_email %}
+ {% elif governance.data_custodians %}
+ {% translate "Contact the data custodian with questions." %}
+ {% elif governance.data_owner.email %}
{% translate "Contact the data owner with questions." %}
{% else %}
{% translate 'Not provided' %}
@@ -32,11 +36,19 @@ {% translate "Contact channe
+{% if governance.data_custodians and governance.data_custodians.0.email %}
+
+
{% translate "Data custodian" %}
+
+ {{ governance.data_custodians.0.email|urlize }}
+
+
+{% else %}
{% translate "IAO or Data Owner" %}
- {% if data_owner_email %}
- {{ data_owner_email|urlize }}
+ {% if governance.data_owner.email %}
+ {{ governance.data_owner.email|urlize }}
{% elif platform.urn == 'performance-hub' %}
No owner is listed as this data is undergoing a review of ownership.
{% else %}
@@ -44,6 +56,7 @@
{% translate "IAO or Data Ow
{% endif %}
+{% endif %}
{% if NOTIFY_ENABLED and entity_name %}
diff --git a/tests/conftest.py b/tests/conftest.py
index ac8129c4..bb87d6fd 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -102,7 +102,7 @@ def request_access(self):
def contact_channels(self):
return self.selenium.find_element(By.ID, "contact_channels")
- def data_owner(self):
+ def data_owner_or_custodian(self):
return self.selenium.find_element(By.ID, "data_owner")
@@ -471,6 +471,9 @@ def generate_database_metadata(
data_stewards=[
OwnerRef(display_name="", email="Contact email for the user", urn="")
],
+ data_custodians=[
+ OwnerRef(display_name="", email="custodian@justice.gov.uk", urn="")
+ ],
),
tags=[TagRef(display_name="some-tag", urn="urn:li:tag:Entity")],
glossary_terms=[
diff --git a/tests/integration/test_details_contact_contents.py b/tests/integration/test_details_contact_contents.py
index b7ce2950..57b6dcee 100644
--- a/tests/integration/test_details_contact_contents.py
+++ b/tests/integration/test_details_contact_contents.py
@@ -56,8 +56,8 @@ def start_on_the_details_page(self):
"Select this link for access information (opens in new tab)",
),
(
- "To access these data you need to seek permission from the data owner by email",
- "To access these data you need to seek permission from the data owner by email",
+ "To access these data you need to seek permission from the data custodian by email",
+ "To access these data you need to seek permission from the data custodian by email",
),
],
)
@@ -83,7 +83,7 @@ def test_access_requirements_content(
assert request_access_metadata.text == expected_text
@pytest.mark.parametrize(
- "access_reqs, slack_channel, owner, expected_text",
+ "access_reqs, slack_channel, custodian, expected_text",
[
(
"Some contact info",
@@ -95,13 +95,13 @@ def test_access_requirements_content(
"",
"#contact_us",
"meta.data@justice.gov.uk",
- "Contact the data owner to request access.",
+ "Contact the data custodian to request access.",
),
(
"",
"",
"meta.data@justice.gov.uk",
- "Contact the data owner to request access.",
+ "Contact the data custodian to request access.",
),
(
"",
@@ -117,17 +117,20 @@ def test_access_requirements_fallbacks(
mock_catalogue,
access_reqs,
slack_channel,
- owner,
+ custodian,
expected_text,
):
if access_reqs:
database.custom_properties.access_information = AccessInformation(
dc_access_requirements=access_reqs
)
- if owner:
- database.governance.data_owner = OwnerRef(
- display_name=owner, email=owner, urn="urn:bla"
- )
+ if custodian:
+ database.governance.data_custodians = [
+ OwnerRef(display_name=custodian, email=custodian, urn="urn:bla")
+ ]
+ else:
+ database.governance.data_custodians = []
+
if slack_channel:
database.custom_properties.further_information = FurtherInformation(
dc_slack_channel_name=slack_channel,
@@ -142,7 +145,7 @@ def test_access_requirements_fallbacks(
assert request_access_metadata.text == expected_text
@pytest.mark.parametrize(
- "slack_channel, owner, expected_text",
+ "slack_channel, custodian, expected_text",
[
(
"#contact-us",
@@ -152,7 +155,7 @@ def test_access_requirements_fallbacks(
(
"",
"meta.data@justice.gov.uk",
- "Contact the data owner with questions.",
+ "Contact the data custodian with questions.",
),
(
"",
@@ -166,13 +169,16 @@ def test_contact_channels_fallbacks(
database,
mock_catalogue,
slack_channel,
- owner,
+ custodian,
expected_text,
):
- if owner:
- database.governance.data_owner = OwnerRef(
- display_name=owner, email=owner, urn="urn:bla"
- )
+ if custodian:
+ database.governance.data_custodians = [
+ OwnerRef(display_name=custodian, email=custodian, urn="urn:bla")
+ ]
+ else:
+ database.governance.data_custodians = []
+
if slack_channel:
database.custom_properties.further_information = FurtherInformation(
dc_slack_channel_name=slack_channel,
@@ -187,7 +193,7 @@ def test_contact_channels_fallbacks(
assert request_access_metadata.text == expected_text
@pytest.mark.parametrize(
- "owner, expected_text",
+ "custodian, expected_text",
[
(
"meta.data@justice.gov.uk",
@@ -203,17 +209,19 @@ def test_data_owner_fallbacks(
self,
database,
mock_catalogue,
- owner,
+ custodian,
expected_text,
):
- if owner:
- database.governance.data_owner = OwnerRef(
- display_name=owner, email=owner, urn="urn:bla"
- )
+ if custodian:
+ database.governance.data_custodians = [
+ OwnerRef(display_name=custodian, email=custodian, urn="urn:bla")
+ ]
+ else:
+ database.governance.data_custodians = []
mock_get_database_details_response(mock_catalogue, database)
self.start_on_the_details_page()
- request_access_metadata = self.details_database_page.data_owner()
+ request_access_metadata = self.details_database_page.data_owner_or_custodian()
assert request_access_metadata.text == expected_text