Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .review_apps/ecs_task_definition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ locals {
{ name = "SETTINGS__AUTH_PROVIDER", value = "developer" },
{ name = "SETTINGS__FORMS_ENV", value = "review" },
{ name = "SETTINGS__FORMS_RUNNER__URL", value = "https://forms.service.gov.uk" },
{ name = "SETTINGS__FEATURES__DAILY_SUBMISSION_EMAILS_ENABLED", value = "true" },
{ name = "SETTINGS__FEATURES__WELSH", value = "true" }
]
}
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/forms/daily_submission_batch_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module Forms
class DailySubmissionBatchController < FormsController
before_action :check_feature_flag

def new
authorize current_form, :can_edit_form?
@daily_submission_batch_input = Forms::DailySubmissionBatchInput.new(form: current_form).assign_form_values
Expand All @@ -20,10 +18,6 @@ def create

private

def check_feature_flag
raise NotFoundError unless FeatureService.enabled?(:daily_submission_emails_enabled)
end

def daily_submission_batch_input_params
params.require(:forms_daily_submission_batch_input).permit(:send_daily_submission_batch).merge(form: current_form)
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/form_task_list_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def how_you_get_completed_forms_section_tasks
def how_you_get_completed_forms_optional_subsection
rows = []
rows << submission_attachments_task if @form.email?
rows << daily_submission_batch_task if FeatureService.enabled?(:daily_submission_emails_enabled)
rows << daily_submission_batch_task

return nil if rows.empty?

Expand Down
12 changes: 5 additions & 7 deletions app/views/forms/_made_live_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,11 @@
<p><%= t(".how_you_get_completed_forms.submission_format.email.#{submission_format}_html") %></p>
<% end %>

<% if FeatureService.enabled?(:daily_submission_emails_enabled) %>
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.daily_csv.title") %></h4>
<% if form_document.send_daily_submission_batch %>
<p><%= t(".how_you_get_completed_forms.daily_csv.enabled") %></p>
<% else %>
<p><%= t(".how_you_get_completed_forms.daily_csv.disabled") %></p>
<% end %>
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.daily_csv.title") %></h4>
<% if form_document.send_daily_submission_batch %>
<p><%= t(".how_you_get_completed_forms.daily_csv.enabled") %></p>
<% else %>
<p><%= t(".how_you_get_completed_forms.daily_csv.disabled") %></p>
<% end %>

<% if form_document.has_welsh_translation? %>
Expand Down
1 change: 0 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ features:
enabled_by_group: true
welsh:
enabled_by_group: true
daily_submission_emails_enabled: false
org_admin_alerts_enabled: false

forms_api:
Expand Down
1 change: 0 additions & 1 deletion spec/config/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
features = settings[:features]

include_examples expected_value_test, :welsh, features, { "enabled_by_group" => true }
include_examples expected_value_test, :daily_submission_emails_enabled, features, false
include_examples expected_value_test, :org_admin_alerts_enabled, features, false
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe Forms::DailySubmissionBatchController, :feature_daily_submission_emails_enabled, type: :request do
RSpec.describe Forms::DailySubmissionBatchController, type: :request do
let(:form) { create(:form, :live, send_daily_submission_batch: send_daily_submission_batch_original_value) }
let(:send_daily_submission_batch_original_value) { false }
let(:current_user) { standard_user }
Expand Down Expand Up @@ -33,12 +33,6 @@
expect(response).to have_http_status(:forbidden)
end
end

context "when the feature flag is disabled", feature_daily_submission_emails_enabled: false do
it "returns 404" do
expect(response).to have_http_status(:not_found)
end
end
end

describe "#create" do
Expand Down
52 changes: 18 additions & 34 deletions spec/services/form_task_list_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,48 +287,32 @@
let(:section_rows) { section[:rows] }
let(:all_task_names) { all_sections.flat_map { |section| section[:rows] }.compact.map { |row| row[:task_name] } }

context "when the daily_submission_emails_enabled feature flag is enabled", :feature_daily_submission_emails_enabled do
context "when the submission type is email" do
it "has link to the submission attachments page" do
expect(section_rows.first[:task_name]).to eq I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.submission_attachments")
expect(section_rows.first[:path]).to eq "/forms/#{form.id}/submission-attachments"
end

it "has the subsection title 'Optional tasks' as there are multiple tasks" do
expect(section[:title]).to eq I18n.t("forms.task_list.optional_tasks_title.other")
end
context "when the submission type is email" do
it "has link to the submission attachments page" do
expect(section_rows.first[:task_name]).to eq I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.submission_attachments")
expect(section_rows.first[:path]).to eq "/forms/#{form.id}/submission-attachments"
end

context "when the submission type is s3" do
let(:form) { create(:form, submission_type: "s3") }
it "has the subsection title 'Optional tasks' as there are multiple tasks" do
expect(section[:title]).to eq I18n.t("forms.task_list.optional_tasks_title.other")
end
end

it "does not have link to the submission attachments page" do
expect(all_task_names).not_to include I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.submission_attachments")
end
context "when the submission type is s3" do
let(:form) { create(:form, submission_type: "s3") }

it "has the subsection title 'Optional task' as there is only one task" do
expect(section[:title]).to eq I18n.t("forms.task_list.optional_tasks_title.one")
end
it "does not have link to the submission attachments page" do
expect(all_task_names).not_to include I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.submission_attachments")
end

it "has link to the daily submission batch page" do
expect(section_rows.second[:task_name]).to eq I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.daily_submission_batch")
expect(section_rows.second[:path]).to eq "/forms/#{form.id}/daily-submission-csv"
it "has the subsection title 'Optional task' as there is only one task" do
expect(section[:title]).to eq I18n.t("forms.task_list.optional_tasks_title.one")
end
end

context "when the daily_submission_emails_enabled feature flag is disabled", feature_daily_submission_emails_enabled: false do
it "does not have link to the daily submission batch page" do
expect(all_task_names).not_to include I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.daily_submission_batch")
end

context "when the submission type is s3" do
let(:form) { create(:form, submission_type: "s3") }

it "does not include the optional tasks subsection at all" do
expect(section[:title]).to eq I18n.t("forms.task_list_create.privacy_and_contact_details_section.title")
end
end
it "has link to the daily submission batch page" do
expect(section_rows.second[:task_name]).to eq I18n.t("forms.task_list_create.how_you_get_completed_forms_section.optional_subsection.daily_submission_batch")
expect(section_rows.second[:path]).to eq "/forms/#{form.id}/daily-submission-csv"
end
end

Expand Down Expand Up @@ -525,7 +509,7 @@
end
end

context "when editing an existing form", :feature_daily_submission_emails_enabled do
context "when editing an existing form" do
let(:form) { create(:form, :live) }
let(:group) { create(:group, :with_welsh_enabled, name: "Group 1", organisation:, status: group_status) }
let(:can_make_form_live) { true }
Expand Down
30 changes: 11 additions & 19 deletions spec/views/forms/_made_live_form.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,29 +189,21 @@
end
end

context "when the daily_submission_emails_enabled feature is enabled", :feature_daily_submission_emails_enabled do
context "when send_daily_submission_batch is true" do
let(:send_daily_submission_batch) { true }
context "when send_daily_submission_batch is true" do
let(:send_daily_submission_batch) { true }

it "tells the user they getting a daily CSV" do
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.enabled"))
end
end

context "when send_daily_submission_batch is false" do
let(:send_daily_submission_batch) { false }

it "tells the user they have not opted to get a daily CSV" do
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.disabled"))
end
it "tells the user they getting a daily CSV" do
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.enabled"))
end
end

context "when the daily_submission_emails_enabled feature is disabled", feature_daily_submission_emails_enabled: false do
it "does not include the daily CSV section" do
expect(rendered).not_to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
context "when send_daily_submission_batch is false" do
let(:send_daily_submission_batch) { false }

it "tells the user they have not opted to get a daily CSV" do
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.disabled"))
end
end

Expand Down
Loading