Skip to content

Commit

Permalink
Merge pull request #10137 from DFE-Digital/500-add-reference-confiden…
Browse files Browse the repository at this point in the history
…tiality-to-support-interfae

[500] Add reference confidentiality to support interface
  • Loading branch information
avinhurry authored Dec 10, 2024
2 parents 140472c + fb8b00e commit 7b0acd4
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div data-qa="reference">
<%= render SummaryCardComponent.new(rows: rows, editable: true) do %>
<%= render SummaryCardComponent.new(rows:, editable: true, warning_text:) do %>
<%= render(SummaryCardHeaderComponent.new(title: title, heading_level: 3)) do %>
<div class="app-summary-card__actions">
<ul class="app-summary-card__actions-list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def rows
email_address_row,
relationship_row,
feedback_row,
confidentiality_row,
date_rows,
sign_in_as_referee_row,
history_row,
Expand All @@ -40,6 +41,13 @@ def title
reference.name
end

def warning_text
return unless reference&.confidential == true
return unless reference&.feedback_provided?

t('support_interface.confidential_warning')
end

private

def status_row
Expand Down Expand Up @@ -215,6 +223,15 @@ def sign_in_as_referee_row
end
end

def confidentiality_row
return unless reference.feedback_provided?

{
key: 'Can this reference be shared with the candidate?',
value: confidentiality_value,
}
end

def history_row
return if reference.not_requested_yet?

Expand Down Expand Up @@ -254,6 +271,10 @@ def feedback_status_colour(reference)
end
end

def confidentiality_value
t("support_interface.references.confidential_warning.#{reference.confidential}")
end

attr_reader :reference
end
end
2 changes: 2 additions & 0 deletions config/locales/support_interface/reference_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ en:
feedback_provided: Feedback provided
feedback_refused: Reference declined
email_bounced: Email bounced
confidential_warning: 'Confidential: do not share with the candidate'

4 changes: 4 additions & 0 deletions config/locales/support_interface/support_interface.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
en:
support_interface:
references:
confidential_warning:
true: No, this reference is confidential. Do not share it.
false: Yes, if they request it.
page_titles:
visa_or_immigration_status: Edit applicant visa or immigration status

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,48 @@
expect(rendered_content).to have_css('h3', text: 'Jane Smith')
end
end

describe 'Confidentiality row' do
context 'when the reference is confidential' do
before do
reference.update(confidential: true, feedback_status: 'feedback_provided')
render_inline(described_class.new(reference:, reference_number: 1, editable:))
end

it 'shows that the reference is confidential' do
expect(rendered_content).to summarise(
key: 'Can this reference be shared with the candidate?',
value: 'No, this reference is confidential. Do not share it.',
)
end
end

context 'when the reference is not confidential' do
before do
reference.update(confidential: false, feedback_status: 'feedback_provided')
render_inline(described_class.new(reference:, reference_number: 1, editable:))
end

it 'shows that the reference is not confidential' do
expect(rendered_content).to summarise(
key: 'Can this reference be shared with the candidate?',
value: 'Yes, if they request it.',
)
end
end

context 'when feedback has not been provided' do
before do
reference.update(confidential: true, feedback_status: 'feedback_requested')
render_inline(described_class.new(reference:, reference_number: 1, editable:))
end

it 'does not show the confidentiality row' do
expect(rendered_content).not_to summarise(
key: 'Can this reference be shared with the candidate?',
value: 'No, this reference is confidential. Do not share it.',
)
end
end
end
end

0 comments on commit 7b0acd4

Please sign in to comment.