From 9e1bb4de46029556f86f01ccfeedd5f8cecc6eb3 Mon Sep 17 00:00:00 2001 From: Stephen Daly Date: Mon, 20 Jul 2026 15:46:12 +0100 Subject: [PATCH 1/3] Update instructions for enabling S3 submissions Update content in the details component on the submission email page to reflect that email submissions can remain switched on when submissions to an S3 bucket are configured. --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index a06fbbfbb..7414500cf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2246,8 +2246,8 @@ en: s3_details: summary_content_html: |

You can get completed forms sent to an AWS S3 bucket instead of an email address.

-

To find out more about this option, including how to set it up, read our guidance on processing completed form submissions.

-

You still need to set an email address here to mark this task complete. When you switch to an S3 bucket, you’ll stop getting completed forms by email.

+

You still need to set an email address here to mark this task complete, even if you do not want to want to receive submissions by email over the long term.

+

To find out how to set an S3 bucket, read our guidance on processing completed form submissions.

summary_text: Get completed forms sent to an AWS S3 bucket share_preview: body_html: | From 4bd815da90e25ae80d913749a801c2f6de533f55 Mon Sep 17 00:00:00 2001 From: Stephen Daly Date: Mon, 20 Jul 2026 16:30:27 +0100 Subject: [PATCH 2/3] Display when delivery to an S3 bucket is enabled for live forms On the live form page, if S3 bucket delivery is enabled, include a subheading "S3 bucket" with details about the bucket name and file format (CSV or JSON). If email delivery is not enabled, do not show the "Email" subheading and the submission email address. --- app/models/form_document/content.rb | 20 +++++- app/views/forms/_made_live_form.html.erb | 13 +++- config/locales/en.yml | 3 + .../forms/_made_live_form.html.erb_spec.rb | 66 +++++++++++++------ 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/app/models/form_document/content.rb b/app/models/form_document/content.rb index e1b5d009f..b83d4a7e1 100644 --- a/app/models/form_document/content.rb +++ b/app/models/form_document/content.rb @@ -61,9 +61,15 @@ def has_email_delivery? end def email_delivery_configuration - delivery_configurations.find do |delivery_configuration| - delivery_configuration["delivery_method"] == "email" && delivery_configuration["delivery_schedule"] == "immediate" - end + immediate_delivery_configuration("email") + end + + def has_s3_delivery? + s3_delivery_configuration.present? + end + + def s3_delivery_configuration + immediate_delivery_configuration("s3") end def daily_submission_batch_enabled? @@ -77,4 +83,12 @@ def weekly_submission_batch_enabled? delivery_configuration["delivery_schedule"] == "weekly" end end + +private + + def immediate_delivery_configuration(delivery_method) + delivery_configurations.find do |delivery_configuration| + delivery_configuration["delivery_method"] == delivery_method && delivery_configuration["delivery_schedule"] == "immediate" + end + end end diff --git a/app/views/forms/_made_live_form.html.erb b/app/views/forms/_made_live_form.html.erb index f513b8cca..eded9dd98 100644 --- a/app/views/forms/_made_live_form.html.erb +++ b/app/views/forms/_made_live_form.html.erb @@ -147,8 +147,17 @@

<%= t(".how_you_get_completed_forms.title") %>

-

<%= t('.how_you_get_completed_forms.submission_email') %>

-

<%= form_document.submission_email %>

+ <% if form_document.has_email_delivery? %> +

<%= t('.how_you_get_completed_forms.submission_email') %>

+

<%= form_document.submission_email %>

+ <% end %> + + <% if form_document.has_s3_delivery? %> +

<%= t('.how_you_get_completed_forms.s3.heading') %>

+

<%= t('.how_you_get_completed_forms.s3.configuration', + delivery_format: form_document.s3_delivery_configuration["formats"].sole.upcase, + bucket_name: form_document.s3_bucket_name) %>

+ <% end %> <% if form_document.has_email_delivery? %> <% formats = ["email", *form_document.email_delivery_configuration["formats"]].join("_") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 7414500cf..0a89e6438 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -501,6 +501,9 @@ en: title: Daily and weekly CSVs weekly_enabled: You are getting a weekly batch of completed forms. csv_and_json: CSV and JSON + s3: + configuration: "%{delivery_format} files sent to %{bucket_name}" + heading: S3 bucket submission_email: Email submission_format: email: diff --git a/spec/views/forms/_made_live_form.html.erb_spec.rb b/spec/views/forms/_made_live_form.html.erb_spec.rb index 3f3f543ea..e5ccedb90 100644 --- a/spec/views/forms/_made_live_form.html.erb_spec.rb +++ b/spec/views/forms/_made_live_form.html.erb_spec.rb @@ -136,15 +136,25 @@ it "contains information about how you get completed forms" do expect(rendered).to have_css("h3", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.title")) - expect(rendered).to have_xpath("//h3[text()='#{I18n.t('forms.made_live_form.how_you_get_completed_forms.title')}']/following-sibling::h4", text: "Email") - expect(rendered).to have_text(form_document.submission_email) end - context "when the submission type is 'email'" do + context "when only email submissions are configured" do + let(:formats) { [] } + let(:form_metadata) do + create(:form, :live, delivery_configurations: [create(:delivery_configuration, :immediate_email, formats: formats)]) + end + + it "has a section for the submission email" do + expect(rendered).to have_xpath("//h3[text()='#{I18n.t('forms.made_live_form.how_you_get_completed_forms.title')}']/following-sibling::h4", text: "Email") + expect(rendered).to have_text(form_document.submission_email) + end + + it "does not have a section for S3 buckets" do + expect(rendered).not_to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.s3.heading")) + end + context "when CSV submission is enabled" do - let(:form_metadata) do - create(:form, :live, delivery_configurations: [create(:delivery_configuration, :immediate_email, formats: %w[csv])]) - end + let(:formats) { %w[csv] } it "tells the user they have CSVs enabled" do expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.csv_and_json")) @@ -153,9 +163,7 @@ end context "when JSON submission is enabled" do - let(:form_metadata) do - create(:form, :live, delivery_configurations: [create(:delivery_configuration, :immediate_email, formats: %w[json])]) - end + let(:formats) { %w[json] } it "tells the user they have JSON submissions enabled" do expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.csv_and_json")) @@ -164,9 +172,7 @@ end context "when both CSV and JSON submissions are enabled" do - let(:form_metadata) do - create(:form, :live, delivery_configurations: [create(:delivery_configuration, :immediate_email, formats: %w[csv json])]) - end + let(:formats) { %w[csv json] } it "tells the user they have CSV and JSON submissions enabled" do expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.csv_and_json")) @@ -174,21 +180,29 @@ end end - context "when CSV submission is not enabled" do - let(:form_metadata) do - create(:form, :live, delivery_configurations: [create(:delivery_configuration, :immediate_email, formats: [])]) - end + context "when no email submission attachments are enabled" do + let(:formats) { [] } - it "tells the user they do not have CSVs enabled" do + it "tells the user they do not have CSV or JSON enabled" do expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.csv_and_json")) expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.submission_format.email.email_html")) end end end - context "when the submission type is 's3'" do + context "when only S3 delivery is configured" do let(:form_metadata) do - create(:form, :live, delivery_configurations: [create(:delivery_configuration, :s3)]) + create(:form, :live, :with_s3_configuration, delivery_configurations: [create(:delivery_configuration, :s3)]) + end + + it "includes a section for the S3 bucket" do + expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.s3.heading")) + expect(rendered).to have_text(I18n.t("forms.made_live_form.how_you_get_completed_forms.s3.configuration", + delivery_format: "CSV", bucket_name: form_document.s3_bucket_name)) + end + + it "does not include a section for email submissions" do + expect(rendered).not_to have_text(form_document.submission_email) end it "does not include the CSV and JSON section" do @@ -196,6 +210,20 @@ end end + context "when both email and s3 delivery are configured" do + let(:form_metadata) do + create(:form, :live, :with_s3_configuration, delivery_configurations: [ + create(:delivery_configuration, :immediate_email), + create(:delivery_configuration, :s3), + ]) + end + + it "includes sections for both email and S3" do + expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.submission_email")) + expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.s3.heading")) + end + end + it "has a section for daily and weekly CSVs" do expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.batch_submissions.title")) end From 30593ac05d58ec778f9dd029d8311187d61c94b9 Mon Sep 17 00:00:00 2001 From: Stephen Daly Date: Thu, 23 Jul 2026 12:50:12 +0100 Subject: [PATCH 3/3] Fix seed for S3 form The form didn't have a format set, which is required for S3 delivery. --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 7a846eb86..694a6c94d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -269,7 +269,7 @@ DeliveryConfiguration.create( delivery_method: :s3, delivery_schedule: :immediate, - formats: [], + formats: %w[csv], ), ], )