Skip to content

Commit 43946b9

Browse files
Merge pull request #5750 from nhsuk/mike/hide-activity-log-for-national-reporting
Hide patient activity log for national reporting teams
2 parents 711da1a + 1959cf1 commit 43946b9

5 files changed

Lines changed: 14 additions & 18 deletions

File tree

app/components/app_activity_log_component.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ def initialize(team:, patient:, session: nil)
1818
@patient = patient
1919

2020
@archive_reasons =
21-
if team.has_upload_only_access?
22-
[]
23-
else
24-
@patient.archive_reasons.where(team:).includes(:created_by)
25-
end
21+
@patient.archive_reasons.where(team:).includes(:created_by)
2622

2723
@attendance_records =
2824
patient

app/policies/patient_policy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def show? = true
77

88
def update? = true
99

10-
def log? = show?
10+
def log? = team.has_poc_only_access?
1111

1212
def pds_search_history? = show?
1313

app/views/patients/show.html.erb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
<%= render "patients/header" %>
99

10-
<%= render AppSecondaryNavigationComponent.new do |nav|
11-
nav.with_item(href: patient_path(@patient), text: "Child record", selected: true)
12-
nav.with_item(href: log_patient_path(@patient), text: "Activity log")
13-
end %>
10+
<% if policy(@patient).log? %>
11+
<%= render AppSecondaryNavigationComponent.new do |nav|
12+
nav.with_item(href: patient_path(@patient), text: "Child record", selected: true)
13+
nav.with_item(href: log_patient_path(@patient), text: "Activity log")
14+
end %>
15+
<% end %>
1416

1517
<% vaccinations_card = capture do %>
1618
<%= render AppCardComponent.new(section: true) do |card| %>

spec/components/app_activity_log_component_spec.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@
8686
notes: "Extra details",
8787
date: "1 June 2024 at 12:00pm",
8888
by: "JOY, Nurse"
89-
90-
context "when viewing as an upload only team" do
91-
let(:team) { create(:team, type: :upload_only, programmes:) }
92-
93-
it "does not render archive events" do
94-
expect(rendered).not_to have_content("Record archived")
95-
end
96-
end
9789
end
9890

9991
describe "consent given by parents" do

spec/features/upload_only_team_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
when_i_visit_the_children_page
3030
and_i_find_a_child(given_name: "Harry", family_name: "Potter")
3131
then_i_should_see_vaccinations_then_child_details
32+
and_the_activity_log_is_hidden
3233
and_child_cannot_be_archived
3334
and_child_does_not_look_archived
3435
end
@@ -200,4 +201,9 @@ def then_i_should_not_see_parent_details
200201
def and_i_should_not_see_add_parent_button
201202
expect(page).not_to have_content("Add parent or guardian")
202203
end
204+
205+
def and_the_activity_log_is_hidden
206+
expect(page).not_to have_content("Activity log")
207+
expect(page).not_to have_content("Child record")
208+
end
203209
end

0 commit comments

Comments
 (0)