Skip to content

Commit

Permalink
fmd-984 - Remove data owner references from app code
Browse files Browse the repository at this point in the history
 - replaced `data_owner` with `data_custodian` in the codebase
 - did not replace any reference to data owner on datahub lib

Signed-off-by: Helder Ribeiro <[email protected]>
  • Loading branch information
hjribeiro-moj committed Nov 13, 2024
1 parent 8d2071a commit 1e8de26
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion feedback/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Migration(migrations.Migration):
),
("entity_name", models.CharField(max_length=250)),
("entity_url", models.CharField(max_length=250)),
("data_owner_email", models.CharField(max_length=250)),
("data_custodian_email", models.CharField(max_length=250)),
(
"user_email",
models.CharField(
Expand Down
4 changes: 2 additions & 2 deletions feedback/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Feedback(models.Model):
class Issue(models.Model):
class IssueChoices(models.TextChoices):
BROKEN_LINK = "Link is broken"
INCORRECT_OWNER = "Owner is incorrect"
INCORRECT_CUSTODIAN = "Data Custodian is incorrect"
OUTDATED_CONTACT = "Contact is outdated"
OTHER = "Other"

Expand All @@ -54,4 +54,4 @@ class IssueChoices(models.TextChoices):
)
entity_name = models.CharField(max_length=250)
entity_url = models.CharField(max_length=250)
data_owner_email = models.CharField(max_length=250)
data_custodian_email = models.CharField(max_length=250)
6 changes: 3 additions & 3 deletions feedback/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def send(

personalisation = {
"assetOwner": (
issue.data_owner_email if issue.data_owner_email else "Data Catalog Team"
issue.data_custodian_email if issue.data_custodian_email else "Data Catalog Team"
),
"userEmail": issue.created_by.email if issue.created_by else "",
"assetName": issue.entity_name,
Expand All @@ -39,11 +39,11 @@ def send(
reference = str(issue.id)

# Notify Data Owner
if issue.data_owner_email:
if issue.data_custodian_email:
notify(
personalisation=personalisation,
template_id=settings.NOTIFY_DATA_OWNER_TEMPLATE_ID,
email_address=issue.data_owner_email,
email_address=issue.data_custodian_email,
reference=reference,
client=client,
)
Expand Down
4 changes: 2 additions & 2 deletions feedback/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def report_issue_view(request) -> HttpResponse:
issue = form.save(commit=False)
issue.entity_name = request.session.get("entity_name")
issue.entity_url = request.session.get("entity_url")
issue.data_owner_email = request.session.get("data_owner_email")
issue.data_custodian_email = request.session.get("data_custodian_email")

# in production, there should always be a signed in user,
# but this may not be the case in local development/unit tests
Expand Down Expand Up @@ -81,7 +81,7 @@ def report_issue_view(request) -> HttpResponse:

request.session["entity_name"] = entity_name
request.session["entity_url"] = entity_url
request.session["data_owner_email"] = _(request.GET.get("data_owner_email", ""))
request.session["data_custodian_email"] = _(request.GET.get("data_custodian_email", ""))

form = IssueForm()

Expand Down
2 changes: 1 addition & 1 deletion templates/partial/contact_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ <h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Data custodian

{% if NOTIFY_ENABLED and entity_name %}
<div class="govuk-body">
<a type="button" class="govuk-button" href="{% url 'feedback:report-issue' %}?entity_name={{ entity_name }}&data_owner_email={{ data_owner_email }}&entity_url={{ request.build_absolute_uri}}" class="govuk-link">Report an issue</a>
<a type="button" class="govuk-button" href="{% url 'feedback:report-issue' %}?entity_name={{ entity_name }}&data_custodian_email={{ data_custodian_email }}&entity_url={{ request.build_absolute_uri}}" class="govuk-link">Report an issue</a>
</div>
{% endif %}
8 changes: 4 additions & 4 deletions tests/feedback/test_notify_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_send_all_notifications(mock_notifications_client, reporter):
"additional_info": "This is some additional information.",
"entity_name": "my_entity",
"entity_url": "http://localhost/my_entity",
"data_owner_email": "[email protected]",
"data_custodian_email": "[email protected]",
"created_by": reporter,
}

Expand All @@ -24,7 +24,7 @@ def test_send_all_notifications(mock_notifications_client, reporter):


@pytest.mark.django_db
def test_send_notifications_no_data_owner_email(mock_notifications_client, reporter):
def test_send_notifications_no_data_custodian_email(mock_notifications_client, reporter):
data = {
"reason": "Other",
"additional_info": "This is some additional information.",
Expand All @@ -48,7 +48,7 @@ def test_send_all_notifications_no_reporter(mock_notifications_client):
"additional_info": "This is some additional information.",
"entity_name": "my_entity",
"entity_url": "http://localhost/my_entity",
"data_owner_email": "[email protected]",
"data_custodian_email": "[email protected]",
}

issue = Issue.objects.create(**data)
Expand All @@ -59,7 +59,7 @@ def test_send_all_notifications_no_reporter(mock_notifications_client):


@pytest.mark.django_db
def test_send_all_notifications_no_reporter_no_data_owner_email(
def test_send_all_notifications_no_reporter_no_data_custodian_email(
mock_notifications_client, reporter
):
data = {
Expand Down
2 changes: 1 addition & 1 deletion tests/feedback/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_form_renders(self, client):
data={
"entity_name": "my_entity",
"entity_url": "http://localhost/my_entity",
"data_owner_email": "[email protected]",
"data_custodian_email": "[email protected]",
},
)
assert response.status_code == 200
Expand Down

0 comments on commit 1e8de26

Please sign in to comment.