Skip to content

Commit 7416367

Browse files
committed
Remove json_submission_enabled feature flag
This feature has been released, so remove the flag and the code for when it was disabled.
1 parent adb5346 commit 7416367

10 files changed

Lines changed: 120 additions & 275 deletions

File tree

.review_apps/ecs_task_definition.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ locals {
2525
{ name = "SETTINGS__AUTH_PROVIDER", value = "developer" },
2626
{ name = "SETTINGS__FORMS_ENV", value = "review" },
2727
{ name = "SETTINGS__FORMS_RUNNER__URL", value = "https://forms.service.gov.uk/" },
28-
{ name = "SETTINGS__FEATURES__JSON_SUBMISSION_ENABLED", value = "true" }
2928
]
3029
}
3130

app/controllers/forms/submission_attachments_controller.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Forms
22
class SubmissionAttachmentsController < WebController
3-
before_action :json_submission_enabled?, :submission_type_email?
3+
before_action :submission_type_email?
44
after_action :verify_authorized
55

66
def new
@@ -25,10 +25,6 @@ def submission_attachments_input_params
2525
params.require(:forms_submission_attachments_input).permit(submission_format: []).merge(form: current_form)
2626
end
2727

28-
def json_submission_enabled?
29-
redirect_to error_404_path unless Settings.features.json_submission_enabled
30-
end
31-
3228
def submission_type_email?
3329
redirect_to error_404_path unless current_form.email?
3430
end

app/services/form_task_list_service.rb

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,33 +104,18 @@ def email_address_section_tasks
104104
end
105105

106106
def submission_attachments_subsection
107-
if FeatureService.enabled?(:json_submission_enabled)
108-
{
109-
title: I18n.t("forms.task_list_#{create_or_edit}.submission_attachments_subsection.title"),
110-
section_number: nil,
111-
subsection: true,
112-
rows: [
113-
{
114-
task_name: I18n.t("forms.task_list_#{create_or_edit}.submission_attachments_subsection.task_name"),
115-
path: submission_attachments_path(@form.id),
116-
status: @task_statuses[:submission_attachments_status],
117-
},
118-
],
119-
}
120-
else
121-
{
122-
title: I18n.t("forms.task_list_#{create_or_edit}.receive_csv_subsection.title"),
123-
section_number: nil,
124-
subsection: true,
125-
rows: [
126-
{
127-
task_name: I18n.t("forms.task_list_#{create_or_edit}.receive_csv_subsection.receive_csv"),
128-
path: receive_csv_path(@form.id),
129-
status: @task_statuses[:submission_attachments_status],
130-
},
131-
],
132-
}
133-
end
107+
{
108+
title: I18n.t("forms.task_list_#{create_or_edit}.submission_attachments_subsection.title"),
109+
section_number: nil,
110+
subsection: true,
111+
rows: [
112+
{
113+
task_name: I18n.t("forms.task_list_#{create_or_edit}.submission_attachments_subsection.task_name"),
114+
path: submission_attachments_path(@form.id),
115+
status: @task_statuses[:submission_attachments_status],
116+
},
117+
],
118+
}
134119
end
135120

136121
def privacy_and_contact_details_section(section_number:)

app/views/forms/_made_live_form.html.erb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,8 @@
5858

5959
<% if form_document.submission_type == "email" %>
6060
<% submission_format = ["email", *form_document.submission_format].join("_") %>
61-
<% if FeatureService.enabled?(:json_submission_enabled) %>
62-
<h4 class="govuk-heading-s"><%= t("made_live_form.csv_and_json") %></h4>
63-
<p><%= t("made_live_form.submission_format.email.#{submission_format}_html") %></p>
64-
<% else %>
65-
<h4 class="govuk-heading-s"><%= t("made_live_form.csv") %></h4>
66-
<p><%= t("made_live_form.submission_format.email.json_submissions_disabled.#{submission_format}") %></p>
67-
<% end %>
61+
<h4 class="govuk-heading-s"><%= t("made_live_form.csv_and_json") %></h4>
62+
<p><%= t("made_live_form.submission_format.email.#{submission_format}_html") %></p>
6863
<% end %>
6964

7065
<h3 class="govuk-heading-m"><%= t('made_live_form.privacy_policy_link') %></h3>

config/locales/en.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,6 @@ en:
446446
contact_details: Provide contact details for support
447447
privacy_policy: Provide a link to privacy information for this form
448448
title: Provide privacy and contact details
449-
receive_csv_subsection:
450-
receive_csv: Get completed forms as CSV files
451-
title: Optional task
452449
submission_attachments_subsection:
453450
task_name: Get a CSV or JSON file of each completed form
454451
title: Optional task
@@ -478,9 +475,6 @@ en:
478475
contact_details: Edit the contact details for support
479476
privacy_policy: Edit the link to privacy information for this form
480477
title: Privacy and contact details
481-
receive_csv_subsection:
482-
receive_csv: Get completed forms as CSV files
483-
title: Optional task
484478
submission_attachments_subsection:
485479
task_name: Get a CSV or JSON file of each completed form
486480
title: Optional task
@@ -1041,7 +1035,6 @@ en:
10411035
made_live_form:
10421036
archive_this_form: Archive this form
10431037
contact_details: Your form’s contact details for support
1044-
csv: CSV
10451038
csv_and_json: CSV and JSON
10461039
declaration: Declaration
10471040
declaration_description: Your form’s declaration is shown to people when they have answered all the questions, just before they submit the form.
@@ -1067,11 +1060,6 @@ en:
10671060
email_json_html: |
10681061
Each completed form is also attached to the email as a JSON file.</br>
10691062
You have not opted to get each completed form as a CSV file.
1070-
json_submissions_disabled:
1071-
email: You have not opted in to receive a CSV file with each completed form email.
1072-
email_csv: Each completed form is also attached to the email as a CSV file.
1073-
email_csv_json: Each completed form is also attached to the email as a CSV file and a JSON file.
1074-
email_json: Each completed form is also attached to the email as a JSON file.
10751063
support_email: Email
10761064
support_phone: Phone
10771065
support_url: Support contact online

config/settings.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ features:
44
enabled_by_group: true
55
welsh:
66
enabled_by_group: true
7-
json_submission_enabled: true
87

98
forms_api:
109
# Authentication key to authenticate with forms-api

spec/config/settings_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
features = settings[:features]
2424

2525
include_examples expected_value_test, :welsh, features, { "enabled_by_group" => true }
26-
include_examples expected_value_test, :json_submission_enabled, features, true
2726
end
2827

2928
describe "forms_api" do

spec/requests/forms/submission_attachments_controller_spec.rb

Lines changed: 72 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -9,152 +9,119 @@
99
end
1010

1111
describe "#new" do
12-
context "when the json_submission_enabled feature flag is off" do
13-
before do
14-
allow(Settings.features).to receive(:json_submission_enabled).and_return(false)
15-
16-
get submission_attachments_path(form_id: form.id)
17-
end
18-
19-
it "returns a 404 page" do
20-
expect(response).to redirect_to :error_404
21-
end
12+
before do
13+
get submission_attachments_path(form_id: form.id)
2214
end
2315

24-
context "when the json_submission_enabled feature flag is on" do
25-
before do
26-
allow(Settings.features).to receive(:json_submission_enabled).and_return(true)
27-
28-
get submission_attachments_path(form_id: form.id)
29-
end
30-
31-
it "renders the submission attachments view" do
32-
expect(response).to have_rendered :new
33-
end
16+
it "renders the submission attachments view" do
17+
expect(response).to have_rendered :new
18+
end
3419

35-
it "uses the form submission attachments input" do
36-
expect(assigns).to include submission_attachments_input: an_instance_of(Forms::SubmissionAttachmentsInput)
37-
end
20+
it "uses the form submission attachments input" do
21+
expect(assigns).to include submission_attachments_input: an_instance_of(Forms::SubmissionAttachmentsInput)
22+
end
3823

39-
context "when the submission_type is s3" do
40-
let(:form) { create(:form, submission_type: "s3") }
24+
context "when the submission_type is s3" do
25+
let(:form) { create(:form, submission_type: "s3") }
4126

42-
it "returns a 404 page" do
43-
expect(response).to redirect_to :error_404
44-
end
27+
it "returns a 404 page" do
28+
expect(response).to redirect_to :error_404
4529
end
4630
end
4731
end
4832

4933
describe "#create" do
5034
let(:params) { { forms_submission_attachments_input: { submission_format: } } }
5135

52-
context "when the json_submission_enabled feature flag is off" do
53-
before do
54-
allow(Settings.features).to receive(:json_submission_enabled).and_return(false)
55-
end
36+
context "when params are valid" do
37+
let(:submission_format) { %w[csv json] }
5638

57-
it "returns a 404 page" do
58-
post submission_attachments_path(form_id: form.id)
59-
expect(response).to redirect_to :error_404
39+
it "updates the form submission format" do
40+
expect {
41+
post(submission_attachments_path(form_id: form.id), params:)
42+
}.to change { form.reload.submission_format }.to(submission_format)
6043
end
61-
end
6244

63-
context "when the json_submission_enabled feature flag is on" do
64-
before do
65-
allow(Settings.features).to receive(:json_submission_enabled).and_return(true)
45+
it "redirects you to the form overview page" do
46+
post(submission_attachments_path(form_id: form.id), params:)
47+
expect(response).to redirect_to(form_path(form.id))
6648
end
6749

68-
context "when params are valid" do
69-
let(:submission_format) { %w[csv json] }
70-
71-
it "updates the form submission format" do
72-
expect {
73-
post(submission_attachments_path(form_id: form.id), params:)
74-
}.to change { form.reload.submission_format }.to(submission_format)
75-
end
50+
context "when submission format has changed to 'csv'" do
51+
let(:submission_format) { %w[csv] }
7652

77-
it "redirects you to the form overview page" do
53+
it "displays a success flash message" do
7854
post(submission_attachments_path(form_id: form.id), params:)
79-
expect(response).to redirect_to(form_path(form.id))
55+
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_csv_enabled"))
8056
end
57+
end
8158

82-
context "when submission format has changed to 'csv'" do
83-
let(:submission_format) { %w[csv] }
59+
context "when submission format has changed to 'json'" do
60+
let(:submission_format) { %w[json] }
8461

85-
it "displays a success flash message" do
86-
post(submission_attachments_path(form_id: form.id), params:)
87-
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_csv_enabled"))
88-
end
62+
it "displays a success flash message" do
63+
post(submission_attachments_path(form_id: form.id), params:)
64+
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_json_enabled"))
8965
end
66+
end
9067

91-
context "when submission format has changed to 'json'" do
92-
let(:submission_format) { %w[json] }
68+
context "when submission format has changed to 'csv json'" do
69+
let(:submission_format) { %w[csv json] }
9370

94-
it "displays a success flash message" do
95-
post(submission_attachments_path(form_id: form.id), params:)
96-
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_json_enabled"))
97-
end
71+
it "displays a success flash message" do
72+
post(submission_attachments_path(form_id: form.id), params:)
73+
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_csv_and_json_enabled"))
9874
end
75+
end
9976

100-
context "when submission format has changed to 'csv json'" do
101-
let(:submission_format) { %w[csv json] }
77+
context "when submission format has changed to blank" do
78+
let(:original_submission_format) { %w[csv json] }
79+
let(:submission_format) { %w[] }
10280

103-
it "displays a success flash message" do
104-
post(submission_attachments_path(form_id: form.id), params:)
105-
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_csv_and_json_enabled"))
106-
end
81+
it "displays a success flash message" do
82+
post(submission_attachments_path(form_id: form.id), params:)
83+
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_no_attachments"))
10784
end
85+
end
10886

109-
context "when submission format has changed to blank" do
110-
let(:original_submission_format) { %w[csv json] }
111-
let(:submission_format) { %w[] }
87+
context "when submission format has not changed" do
88+
let(:submission_format) { %w[] }
11289

113-
it "displays a success flash message" do
114-
post(submission_attachments_path(form_id: form.id), params:)
115-
expect(flash[:success]).to eq(I18n.t("banner.success.form.receive_no_attachments"))
116-
end
90+
it "does not display a flash message" do
91+
post(submission_attachments_path(form_id: form.id), params:)
92+
expect(flash[:success]).to be_nil
11793
end
94+
end
95+
end
11896

119-
context "when submission format has not changed" do
120-
let(:submission_format) { %w[] }
97+
context "when params are invalid" do
98+
let(:submission_format) { %w[apple] }
12199

122-
it "does not display a flash message" do
123-
post(submission_attachments_path(form_id: form.id), params:)
124-
expect(flash[:success]).to be_nil
125-
end
126-
end
100+
it "returns 422" do
101+
post(submission_attachments_path(form_id: form.id), params:)
102+
expect(response).to have_http_status(:unprocessable_content)
127103
end
128104

129-
context "when params are invalid" do
130-
let(:submission_format) { %w[apple] }
131-
132-
it "returns 422" do
105+
it "does not update the form" do
106+
expect {
133107
post(submission_attachments_path(form_id: form.id), params:)
134-
expect(response).to have_http_status(:unprocessable_content)
135-
end
136-
137-
it "does not update the form" do
138-
expect {
139-
post(submission_attachments_path(form_id: form.id), params:)
140-
}.not_to(change { form.reload.submission_format })
141-
end
108+
}.not_to(change { form.reload.submission_format })
109+
end
142110

143-
it "re-renders the page with an error" do
144-
post(submission_attachments_path(form_id: form.id), params:)
145-
expect(response).to render_template("new")
146-
expect(response.body).to include(I18n.t("activemodel.errors.models.forms/submission_attachments_input.invalid_submission_format"))
147-
end
111+
it "re-renders the page with an error" do
112+
post(submission_attachments_path(form_id: form.id), params:)
113+
expect(response).to render_template("new")
114+
expect(response.body).to include(I18n.t("activemodel.errors.models.forms/submission_attachments_input.invalid_submission_format"))
148115
end
116+
end
149117

150-
context "when the submission_type is s3" do
151-
let(:form) { create(:form, submission_type: "s3") }
152-
let(:submission_format) { %w[csv] }
118+
context "when the submission_type is s3" do
119+
let(:form) { create(:form, submission_type: "s3") }
120+
let(:submission_format) { %w[csv] }
153121

154-
it "returns a 404 page" do
155-
post(submission_attachments_path(form_id: form.id), params:)
156-
expect(response).to redirect_to :error_404
157-
end
122+
it "returns a 404 page" do
123+
post(submission_attachments_path(form_id: form.id), params:)
124+
expect(response).to redirect_to :error_404
158125
end
159126
end
160127
end

0 commit comments

Comments
 (0)