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
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ def form_admin_options_params
:service_id,
:service_stage_id,
:enforce_new_submission_validations,
:legacy_link_feature_flag,
)
end

Expand Down
8 changes: 3 additions & 5 deletions app/controllers/admin/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions app/views/admin/forms/_admin_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@
<% end %>
</div>
</fieldset>
<fieldset class="usa-fieldset">
<legend class="usa-sr-only">legacy_link_feature_flag</legend>
<div class="usa-checkbox">
<%= 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 %>
</div>
</fieldset>
</div>
</div>
<p class="margin-top-4">
Expand Down
8 changes: 1 addition & 7 deletions app/views/components/widget/_fba.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 %>",
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20250227193906_rm_form_legacy_link_option.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RmFormLegacyLinkOption < ActiveRecord::Migration[8.0]
def change
remove_column :forms, :legacy_link_feature_flag
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions spec/features/embedded_touchpoints_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -97,5 +96,4 @@
end
end
end
end # legacy_link_feature_flag_setting
end
8 changes: 8 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/rack_attack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down