From fc6608e09863732181234b7d350ade1d9a3b1dba Mon Sep 17 00:00:00 2001 From: ChrisBAshton Date: Thu, 17 Oct 2024 13:37:15 +0100 Subject: [PATCH] Allow file attachments on Case Studies This brings them into line with News Stories and Detailed Guides. We can't see a reason why Case Studies should not be allowed file attachments, and it has caused issues for publishers in at least one case: https://govuk.zendesk.com/agent/tickets/5595072 Trello: https://trello.com/c/uJccMA6o/2844-allow-non-html-attachments-for-case-studies --- app/models/case_study.rb | 1 + test/unit/app/helpers/admin/tabbed_nav_helper_test.rb | 2 +- test/unit/app/models/case_study_test.rb | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/case_study.rb b/app/models/case_study.rb index 0071e6f2e0d..f8ff8c93348 100644 --- a/app/models/case_study.rb +++ b/app/models/case_study.rb @@ -1,6 +1,7 @@ class CaseStudy < Edition include Edition::Searchable + include ::Attachable include Edition::Images include Edition::FactCheckable include Edition::CustomLeadImage diff --git a/test/unit/app/helpers/admin/tabbed_nav_helper_test.rb b/test/unit/app/helpers/admin/tabbed_nav_helper_test.rb index dd8b21dacea..2543787d16a 100644 --- a/test/unit/app/helpers/admin/tabbed_nav_helper_test.rb +++ b/test/unit/app/helpers/admin/tabbed_nav_helper_test.rb @@ -160,7 +160,7 @@ def current_user end test "#secondary_navigation_tabs_items for persisted editions which do not allow attachments" do - %i[case_study fatality_notice speech].each do |type| + %i[fatality_notice speech].each do |type| edition = build_stubbed(type) expected_output = [ diff --git a/test/unit/app/models/case_study_test.rb b/test/unit/app/models/case_study_test.rb index 4a1e2cfa5b1..32a6749d855 100644 --- a/test/unit/app/models/case_study_test.rb +++ b/test/unit/app/models/case_study_test.rb @@ -4,6 +4,8 @@ class CaseStudyTest < ActiveSupport::TestCase include ActionDispatch::TestProcess should_allow_image_attachments + should_be_attachable + should_allow_inline_attachments should_have_custom_lead_image should_protect_against_xss_and_content_attacks_on :case_study, :body