diff --git a/Gemfile.lock b/Gemfile.lock index 9a4dfcbd1..5f237a2b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -228,7 +228,8 @@ GEM drb (2.2.1) dumb_delegator (1.1.0) erubi (1.13.1) - excon (1.2.4) + excon (1.2.5) + logger factory_bot (6.5.1) activesupport (>= 6.1.0) factory_bot_rails (6.4.4) @@ -394,7 +395,7 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - omniauth (2.1.2) + omniauth (2.1.3) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection @@ -526,7 +527,7 @@ GEM rspec-support (3.13.2) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.73.0) + rubocop (1.73.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) diff --git a/app/controllers/admin/forms_controller.rb b/app/controllers/admin/forms_controller.rb index cab7f5cd1..7bce2a7b0 100644 --- a/app/controllers/admin/forms_controller.rb +++ b/app/controllers/admin/forms_controller.rb @@ -582,7 +582,6 @@ def form_admin_options_params :service_id, :service_stage_id, :enforce_new_submission_validations, - :legacy_link_feature_flag, ) end diff --git a/app/controllers/admin/submissions_controller.rb b/app/controllers/admin/submissions_controller.rb index a63d2f9e0..41bb20ba7 100644 --- a/app/controllers/admin/submissions_controller.rb +++ b/app/controllers/admin/submissions_controller.rb @@ -141,13 +141,11 @@ def submissions_table end if @show_flagged - @submissions = @submissions.flagged + @submissions = @submissions.flagged.non_deleted elsif @show_marked_as_spam - @submissions = @submissions.marked_as_spam + @submissions = @submissions.marked_as_spam.non_deleted elsif @show_archived - @submissions = @submissions.archived - elsif @show_deleted - @submissions = @submissions.deleted + @submissions = @submissions.archived.non_deleted elsif @show_deleted @submissions = @submissions.deleted else diff --git a/app/models/form.rb b/app/models/form.rb index f48ced3e8..e509630de 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -227,7 +227,6 @@ def duplicate!(new_user:) new_form.organization = new_user.organization new_form.template = false new_form.enforce_new_submission_validations = true - new_form.legacy_link_feature_flag = false new_form.save! # Manually remove the Form Section created with create_first_form_section diff --git a/app/views/admin/forms/_admin_options.html.erb b/app/views/admin/forms/_admin_options.html.erb index 21b224fdf..0aaddfa11 100644 --- a/app/views/admin/forms/_admin_options.html.erb +++ b/app/views/admin/forms/_admin_options.html.erb @@ -66,15 +66,6 @@ <% end %> -
- legacy_link_feature_flag -
- <%= f.check_box :legacy_link_feature_flag, class: "usa-checkbox__input" %> - <%= f.label :legacy_link_feature_flag, class: "usa-checkbox__label" do %> - legacy_link_feature_flag - <% end %> -
-

diff --git a/app/views/components/widget/_fba.js.erb b/app/views/components/widget/_fba.js.erb index ebefad59d..f7e1b4075 100644 --- a/app/views/components/widget/_fba.js.erb +++ b/app/views/components/widget/_fba.js.erb @@ -370,12 +370,7 @@ function FBAform(d, N) { // Add the fixed, floating tab button <%# FEATURE FLAG %> - if(this.options.legacyLink) { - this.buttonEl = d.createElement('a'); - this.buttonEl.setAttribute('href', 'javascript:void(0)'); - } else { - this.buttonEl = d.createElement('button'); - } + this.buttonEl = d.createElement('button'); this.buttonEl.setAttribute('id', 'fba-button'); this.buttonEl.setAttribute('data-id', this.options.formId); this.buttonEl.setAttribute('class', 'fba-button fixed-tab-button usa-button'); @@ -645,7 +640,6 @@ function FBAform(d, N) { // Specify the options for your form const touchpointFormOptions<%= form.short_uuid %> = { - 'legacyLink': <%= form.legacy_link_feature_flag? %>, 'formId': "<%= form.short_uuid %>", 'modalButtonText': "<%= form.modal_button_text %>", 'elementSelector': "<%= form.element_selector %>", diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index f4ce0edc2..61f0b3f97 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -15,7 +15,7 @@ class Rack::Attack # Is the request to the form submission route? def self.submission_route?(req) - !!(req.path =~ %r{^/submissions/[\h]{1,8}\.json$}i) + !!(req.path =~ %r{^/touchpoints/[\h]{1,8}/submissions\.json$}i) end # Response for throttled requests diff --git a/db/migrate/20250227193906_rm_form_legacy_link_option.rb b/db/migrate/20250227193906_rm_form_legacy_link_option.rb new file mode 100644 index 000000000..71d6e0440 --- /dev/null +++ b/db/migrate/20250227193906_rm_form_legacy_link_option.rb @@ -0,0 +1,5 @@ +class RmFormLegacyLinkOption < ActiveRecord::Migration[8.0] + def change + remove_column :forms, :legacy_link_feature_flag + end +end diff --git a/db/schema.rb b/db/schema.rb index 7c941841d..cd63ff1f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_02_26_221548) do +ActiveRecord::Schema[8.0].define(version: 2025_02_27_193906) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -311,7 +311,6 @@ t.string "short_uuid", limit: 8 t.boolean "enforce_new_submission_validations", default: true t.integer "service_stage_id" - t.boolean "legacy_link_feature_flag", default: false, comment: "when true, render fba-button as an A, otherwise render as BUTTON" t.index ["legacy_touchpoint_id"], name: "index_forms_on_legacy_touchpoint_id" t.index ["legacy_touchpoint_uuid"], name: "index_forms_on_legacy_touchpoint_uuid" t.index ["organization_id"], name: "index_forms_on_organization_id" diff --git a/spec/features/embedded_touchpoints_spec.rb b/spec/features/embedded_touchpoints_spec.rb index c582f4e23..a08b49edd 100644 --- a/spec/features/embedded_touchpoints_spec.rb +++ b/spec/features/embedded_touchpoints_spec.rb @@ -6,9 +6,8 @@ let(:organization) { FactoryBot.create(:organization) } let!(:user) { FactoryBot.create(:user, :admin, organization:) } - [true, false].each do |legacy_link_feature_flag_setting| context "as Admin" do - let!(:form) { FactoryBot.create(:form, :kitchen_sink, organization:, legacy_link_feature_flag: legacy_link_feature_flag_setting) } + let!(:form) { FactoryBot.create(:form, :kitchen_sink, organization:) } describe '/forms/:id/example' do before do @@ -97,5 +96,4 @@ end end end - end # legacy_link_feature_flag_setting end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e8c28c2f5..592926e72 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -107,6 +107,14 @@ DatabaseCleaner.start end + # Disable Rack throttling for feature specs + config.before(:each, type: :feature) do + Rack::Attack.enabled = false + end + config.after(:each, type: :feature) do + Rack::Attack.enabled = true + end + config.after(:each, js: true) do errors = page.driver.browser.logs.get(:browser) if errors.present? diff --git a/spec/requests/rack_attack_spec.rb b/spec/requests/rack_attack_spec.rb index 1833ce6e1..b94ecda71 100644 --- a/spec/requests/rack_attack_spec.rb +++ b/spec/requests/rack_attack_spec.rb @@ -7,7 +7,7 @@ let(:ip) { '1.2.3.4' } let(:headers) { { 'REMOTE_ADDR' => ip } } - let(:valid_submission_path) { "/submissions/1234abcd.json" } + let(:valid_submission_path) { "/touchpoints/1234abcd/submissions.json" } it 'allows up to 10 requests per minute' do 10.times do