From 0201bcf211589f01d388639c87afb5a1229f7275 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 25 Jan 2024 10:47:13 +0000 Subject: [PATCH 1/3] increase upload threshold to 40 files --- app/validators/file_upload_validator.rb | 2 +- .../public_referrals/allegation_evidence/upload/edit.html.erb | 2 +- spec/forms/referrals/allegation_evidence/upload_form_spec.rb | 2 +- .../public_referrals/user_adds_allegation_evidence_spec.rb | 2 +- spec/system/referrals/user_adds_allegation_evidence_spec.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/validators/file_upload_validator.rb b/app/validators/file_upload_validator.rb index 44e1c7172..053c3d6cd 100644 --- a/app/validators/file_upload_validator.rb +++ b/app/validators/file_upload_validator.rb @@ -2,7 +2,7 @@ class FileUploadValidator < ActiveModel::EachValidator include FileSizeHelper MAX_FILE_SIZE = 100.megabytes - MAX_FILES = 20 + MAX_FILES = 40 CONTENT_TYPES = { ".apng" => "image/apng", diff --git a/app/views/public_referrals/allegation_evidence/upload/edit.html.erb b/app/views/public_referrals/allegation_evidence/upload/edit.html.erb index 064196976..79cfb78f9 100644 --- a/app/views/public_referrals/allegation_evidence/upload/edit.html.erb +++ b/app/views/public_referrals/allegation_evidence/upload/edit.html.erb @@ -34,7 +34,7 @@ :evidence_uploads, multiple: true, label: { text: "Upload files", size: "m" }, - hint: { text: "You can upload up to 20 files. Each file must be smaller than #{max_allowed_file_size}. Larger files may take longer to upload. We will let you know when it is done." } + hint: { text: "You can upload up to #{FileUploadValidator::MAX_FILES} files. Each file must be smaller than #{max_allowed_file_size}. Larger files may take longer to upload. We will let you know when it is done." } ) %> <%= f.govuk_submit "Save and continue" %> diff --git a/spec/forms/referrals/allegation_evidence/upload_form_spec.rb b/spec/forms/referrals/allegation_evidence/upload_form_spec.rb index cecd79ff3..b4735e525 100644 --- a/spec/forms/referrals/allegation_evidence/upload_form_spec.rb +++ b/spec/forms/referrals/allegation_evidence/upload_form_spec.rb @@ -71,7 +71,7 @@ fixture_file_upload("upload.txt") end expect(upload_form.save).to be false - expect(upload_form.errors[:evidence_uploads]).to eq(["You can only upload 20 files"]) + expect(upload_form.errors[:evidence_uploads]).to eq(["You can only upload 40 files"]) end end end diff --git a/spec/system/public_referrals/user_adds_allegation_evidence_spec.rb b/spec/system/public_referrals/user_adds_allegation_evidence_spec.rb index 3366ef3a6..26f24e692 100644 --- a/spec/system/public_referrals/user_adds_allegation_evidence_spec.rb +++ b/spec/system/public_referrals/user_adds_allegation_evidence_spec.rb @@ -360,7 +360,7 @@ def then_cannot_add_more_evidence def then_i_see_a_list_of_max_uploaded_files expect(page).to have_content("Uploaded evidence") within(".govuk-summary-list") do - expect(page).to have_link("upload1.pdf", count: 20, href: /active_storage/) + expect(page).to have_link("upload1.pdf", count: 40, href: /active_storage/) end end end diff --git a/spec/system/referrals/user_adds_allegation_evidence_spec.rb b/spec/system/referrals/user_adds_allegation_evidence_spec.rb index a833aae90..6be137ef0 100644 --- a/spec/system/referrals/user_adds_allegation_evidence_spec.rb +++ b/spec/system/referrals/user_adds_allegation_evidence_spec.rb @@ -361,7 +361,7 @@ def when_i_upload_the_maximum_number_of_files def then_i_see_a_list_of_max_uploaded_files expect(page).to have_content("Uploaded evidence") within(".govuk-summary-list") do - expect(page).to have_link("upload1.pdf", count: 20, href: /active_storage/) + expect(page).to have_link("upload1.pdf", count: 40, href: /active_storage/) end end From bed1631762770fd388a44fda43732d3d9e97a915 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 25 Jan 2024 13:11:43 +0000 Subject: [PATCH 2/3] refactor: remove pointless whitespace --- .../public_referrals/allegation_evidence/upload/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/public_referrals/allegation_evidence/upload/edit.html.erb b/app/views/public_referrals/allegation_evidence/upload/edit.html.erb index 79cfb78f9..56dd99fa0 100644 --- a/app/views/public_referrals/allegation_evidence/upload/edit.html.erb +++ b/app/views/public_referrals/allegation_evidence/upload/edit.html.erb @@ -2,7 +2,7 @@ <% content_for :back_link_url, back_link_url %>
-
+
<%= form_with model: form, url: form_path, method: :patch do |f| %> <%= f.govuk_error_summary %> From b9069ddb2fd30745e33cf8ebfa279ea714d8927f Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 25 Jan 2024 13:12:01 +0000 Subject: [PATCH 3/3] align hint text for file upload --- app/views/referrals/allegation_evidence/upload/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/referrals/allegation_evidence/upload/edit.html.erb b/app/views/referrals/allegation_evidence/upload/edit.html.erb index a01e91701..5875cd02a 100644 --- a/app/views/referrals/allegation_evidence/upload/edit.html.erb +++ b/app/views/referrals/allegation_evidence/upload/edit.html.erb @@ -44,7 +44,7 @@ :evidence_uploads, multiple: true, label: { text: "Upload files", size: "m" }, - hint: { text: "Must be smaller than #{max_allowed_file_size}" } + hint: { text: "You can upload up to #{FileUploadValidator::MAX_FILES} files. Each file must be smaller than #{max_allowed_file_size}. Larger files may take longer to upload. We will let you know when it is done." } ) %> <%= f.govuk_submit "Save and continue" %>