From b922ecd20c39d2ed9f6891ee0cc3a8b11ee541d9 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 20 Jul 2023 11:56:43 +0100 Subject: [PATCH] Update success banner --- app/controllers/form_controller.rb | 5 ++++- config/locales/en.yml | 2 ++ spec/features/lettings_log_spec.rb | 2 ++ spec/features/sales_log_spec.rb | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index dd30a6b86..8fd7a2c52 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -257,6 +257,9 @@ private end def deduplication_success_banner - "Log #{@log.id} is no longer a duplicate and has been removed from the list".html_safe + deduplicated_log_link = "Log #{@log.id}" + changed_question_label = (@page.questions.first.check_answer_label.to_s.presence || @page.questions.first.header.to_s).downcase + + I18n.t("notification.duplicate_logs.deduplication_success_banner", log_link: deduplicated_log_link, changed_question_label:).html_safe end end diff --git a/config/locales/en.yml b/config/locales/en.yml index fb29431e1..41b6454c7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -187,6 +187,8 @@ en: duplicate_logs_deleted: one: "%{log_ids} has been deleted." other: "%{log_ids} have been deleted." + duplicate_logs: + deduplication_success_banner: "%{log_link} is no longer a duplicate and has been removed from the list.

You changed the %{changed_question_label}.

" validations: organisation: diff --git a/spec/features/lettings_log_spec.rb b/spec/features/lettings_log_spec.rb index 4357b3c20..6153271f8 100644 --- a/spec/features/lettings_log_spec.rb +++ b/spec/features/lettings_log_spec.rb @@ -515,6 +515,7 @@ RSpec.describe "Lettings Log Features" do expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list") + expect(page).to have_content("You changed the tenant code.") end it "allows deduplicating logs by changing the answers on the original log" do @@ -525,6 +526,7 @@ RSpec.describe "Lettings Log Features" do expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_content("Log #{lettings_log.id} is no longer a duplicate and has been removed from the list") + expect(page).to have_content("You changed the tenant code.") end end end diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index fae1d030b..52cb4c7f9 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -254,6 +254,7 @@ RSpec.describe "Sales Log Features" do expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list") + expect(page).to have_content("You changed the purchaser code.") end it "allows deduplicating logs by changing the answers on the original log" do @@ -264,6 +265,7 @@ RSpec.describe "Sales Log Features" do expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_content("Log #{sales_log.id} is no longer a duplicate and has been removed from the list") + expect(page).to have_content("You changed the purchaser code.") end end end