Skip to content

Commit e7e7ee7

Browse files
remove legacy form embed
2 parents ee55a71 + 38659e9 commit e7e7ee7

20 files changed

Lines changed: 285 additions & 1084 deletions

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ gem 'newrelic_rpm'
6363
gem 'omniauth-github'
6464
gem 'omniauth_login_dot_gov', git: 'https://github.com/18F/omniauth_login_dot_gov.git', branch: 'main'
6565
gem 'omniauth-rails_csrf_protection'
66+
gem 'rack-attack'
6667
gem 'rack-cors', require: 'rack/cors'
6768
# Use Redis to cache Touchpoints in all envs
6869
gem 'redis-client'

Gemfile.lock

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ GEM
1818
aasm-diagram (0.1.3)
1919
aasm (~> 5.0, >= 4.12)
2020
ruby-graphviz (~> 1.2)
21-
actioncable (7.2.1.2)
22-
actionpack (= 7.2.1.2)
23-
activesupport (= 7.2.1.2)
21+
actioncable (7.2.2.1)
22+
actionpack (= 7.2.2.1)
23+
activesupport (= 7.2.2.1)
2424
nio4r (~> 2.0)
2525
websocket-driver (>= 0.6.1)
2626
zeitwerk (~> 2.6)
27-
actionmailbox (7.2.1.2)
28-
actionpack (= 7.2.1.2)
29-
activejob (= 7.2.1.2)
30-
activerecord (= 7.2.1.2)
31-
activestorage (= 7.2.1.2)
32-
activesupport (= 7.2.1.2)
27+
actionmailbox (7.2.2.1)
28+
actionpack (= 7.2.2.1)
29+
activejob (= 7.2.2.1)
30+
activerecord (= 7.2.2.1)
31+
activestorage (= 7.2.2.1)
32+
activesupport (= 7.2.2.1)
3333
mail (>= 2.8.0)
34-
actionmailer (7.2.1.2)
35-
actionpack (= 7.2.1.2)
36-
actionview (= 7.2.1.2)
37-
activejob (= 7.2.1.2)
38-
activesupport (= 7.2.1.2)
34+
actionmailer (7.2.2.1)
35+
actionpack (= 7.2.2.1)
36+
actionview (= 7.2.2.1)
37+
activejob (= 7.2.2.1)
38+
activesupport (= 7.2.2.1)
3939
mail (>= 2.8.0)
4040
rails-dom-testing (~> 2.2)
41-
actionpack (7.2.1.2)
42-
actionview (= 7.2.1.2)
43-
activesupport (= 7.2.1.2)
41+
actionpack (7.2.2.1)
42+
actionview (= 7.2.2.1)
43+
activesupport (= 7.2.2.1)
4444
nokogiri (>= 1.8.5)
4545
racc
4646
rack (>= 2.2.4, < 3.2)
@@ -49,15 +49,15 @@ GEM
4949
rails-dom-testing (~> 2.2)
5050
rails-html-sanitizer (~> 1.6)
5151
useragent (~> 0.16)
52-
actiontext (7.2.1.2)
53-
actionpack (= 7.2.1.2)
54-
activerecord (= 7.2.1.2)
55-
activestorage (= 7.2.1.2)
56-
activesupport (= 7.2.1.2)
52+
actiontext (7.2.2.1)
53+
actionpack (= 7.2.2.1)
54+
activerecord (= 7.2.2.1)
55+
activestorage (= 7.2.2.1)
56+
activesupport (= 7.2.2.1)
5757
globalid (>= 0.6.0)
5858
nokogiri (>= 1.8.5)
59-
actionview (7.2.1.2)
60-
activesupport (= 7.2.1.2)
59+
actionview (7.2.2.1)
60+
activesupport (= 7.2.2.1)
6161
builder (~> 3.1)
6262
erubi (~> 1.11)
6363
rails-dom-testing (~> 2.2)
@@ -67,23 +67,24 @@ GEM
6767
activemodel (>= 4.1)
6868
case_transform (>= 0.2)
6969
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
70-
activejob (7.2.1.2)
71-
activesupport (= 7.2.1.2)
70+
activejob (7.2.2.1)
71+
activesupport (= 7.2.2.1)
7272
globalid (>= 0.3.6)
73-
activemodel (7.2.1.2)
74-
activesupport (= 7.2.1.2)
75-
activerecord (7.2.1.2)
76-
activemodel (= 7.2.1.2)
77-
activesupport (= 7.2.1.2)
73+
activemodel (7.2.2.1)
74+
activesupport (= 7.2.2.1)
75+
activerecord (7.2.2.1)
76+
activemodel (= 7.2.2.1)
77+
activesupport (= 7.2.2.1)
7878
timeout (>= 0.4.0)
79-
activestorage (7.2.1.2)
80-
actionpack (= 7.2.1.2)
81-
activejob (= 7.2.1.2)
82-
activerecord (= 7.2.1.2)
83-
activesupport (= 7.2.1.2)
79+
activestorage (7.2.2.1)
80+
actionpack (= 7.2.2.1)
81+
activejob (= 7.2.2.1)
82+
activerecord (= 7.2.2.1)
83+
activesupport (= 7.2.2.1)
8484
marcel (~> 1.0)
85-
activesupport (7.2.1.2)
85+
activesupport (7.2.2.1)
8686
base64
87+
benchmark (>= 0.3)
8788
bigdecimal
8889
concurrent-ruby (~> 1.0, >= 1.3.1)
8990
connection_pool (>= 2.2.5)
@@ -164,6 +165,7 @@ GEM
164165
thread_safe (~> 0.3, >= 0.3.1)
165166
base64 (0.2.0)
166167
bcrypt (3.1.20)
168+
benchmark (0.4.0)
167169
bigdecimal (3.1.8)
168170
bindata (2.5.0)
169171
bindex (0.8.1)
@@ -279,7 +281,7 @@ GEM
279281
activesupport (>= 6.0.0)
280282
railties (>= 6.0.0)
281283
io-console (0.8.0)
282-
irb (1.14.1)
284+
irb (1.14.3)
283285
rdoc (>= 4.0.0)
284286
reline (>= 0.4.2)
285287
jbuilder (2.13.0)
@@ -319,8 +321,8 @@ GEM
319321
listen (3.9.0)
320322
rb-fsevent (~> 0.10, >= 0.10.3)
321323
rb-inotify (~> 0.9, >= 0.9.10)
322-
logger (1.6.2)
323-
logstop (0.3.1)
324+
logger (1.6.4)
325+
logstop (0.4.0)
324326
loofah (2.23.1)
325327
crass (~> 1.0.2)
326328
nokogiri (>= 1.12.0)
@@ -345,7 +347,7 @@ GEM
345347
bigdecimal (~> 3.1)
346348
net-http (0.6.0)
347349
uri
348-
net-imap (0.5.1)
350+
net-imap (0.5.2)
349351
date
350352
net-protocol
351353
net-pop (0.1.2)
@@ -356,17 +358,17 @@ GEM
356358
net-protocol
357359
newrelic_rpm (9.16.1)
358360
nio4r (2.7.4)
359-
nokogiri (1.16.8-aarch64-linux)
361+
nokogiri (1.17.2-aarch64-linux)
360362
racc (~> 1.4)
361-
nokogiri (1.16.8-arm-linux)
363+
nokogiri (1.17.2-arm-linux)
362364
racc (~> 1.4)
363-
nokogiri (1.16.8-arm64-darwin)
365+
nokogiri (1.17.2-arm64-darwin)
364366
racc (~> 1.4)
365-
nokogiri (1.16.8-x86-linux)
367+
nokogiri (1.17.2-x86-linux)
366368
racc (~> 1.4)
367-
nokogiri (1.16.8-x86_64-darwin)
369+
nokogiri (1.17.2-x86_64-darwin)
368370
racc (~> 1.4)
369-
nokogiri (1.16.8-x86_64-linux)
371+
nokogiri (1.17.2-x86_64-linux)
370372
racc (~> 1.4)
371373
oauth2 (2.0.9)
372374
faraday (>= 0.17.3, < 3.0)
@@ -401,14 +403,16 @@ GEM
401403
pry (0.15.0)
402404
coderay (~> 1.1)
403405
method_source (~> 1.0)
404-
psych (5.2.1)
406+
psych (5.2.2)
405407
date
406408
stringio
407409
public_suffix (6.0.1)
408410
puma (6.5.0)
409411
nio4r (~> 2.0)
410412
racc (1.8.1)
411413
rack (3.1.8)
414+
rack-attack (6.7.0)
415+
rack (>= 1.0, < 4)
412416
rack-cors (2.0.2)
413417
rack (>= 2.0.0)
414418
rack-protection (4.1.1)
@@ -421,20 +425,20 @@ GEM
421425
rack (>= 1.3)
422426
rackup (2.2.1)
423427
rack (>= 3)
424-
rails (7.2.1.2)
425-
actioncable (= 7.2.1.2)
426-
actionmailbox (= 7.2.1.2)
427-
actionmailer (= 7.2.1.2)
428-
actionpack (= 7.2.1.2)
429-
actiontext (= 7.2.1.2)
430-
actionview (= 7.2.1.2)
431-
activejob (= 7.2.1.2)
432-
activemodel (= 7.2.1.2)
433-
activerecord (= 7.2.1.2)
434-
activestorage (= 7.2.1.2)
435-
activesupport (= 7.2.1.2)
428+
rails (7.2.2.1)
429+
actioncable (= 7.2.2.1)
430+
actionmailbox (= 7.2.2.1)
431+
actionmailer (= 7.2.2.1)
432+
actionpack (= 7.2.2.1)
433+
actiontext (= 7.2.2.1)
434+
actionview (= 7.2.2.1)
435+
activejob (= 7.2.2.1)
436+
activemodel (= 7.2.2.1)
437+
activerecord (= 7.2.2.1)
438+
activestorage (= 7.2.2.1)
439+
activesupport (= 7.2.2.1)
436440
bundler (>= 1.15.0)
437-
railties (= 7.2.1.2)
441+
railties (= 7.2.2.1)
438442
rails-controller-testing (1.0.5)
439443
actionpack (>= 5.0.1.rc1)
440444
actionview (>= 5.0.1.rc1)
@@ -448,12 +452,12 @@ GEM
448452
activesupport (>= 4.2)
449453
choice (~> 0.2.0)
450454
ruby-graphviz (~> 1.2)
451-
rails-html-sanitizer (1.6.1)
455+
rails-html-sanitizer (1.6.2)
452456
loofah (~> 2.21)
453457
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
454-
railties (7.2.1.2)
455-
actionpack (= 7.2.1.2)
456-
activesupport (= 7.2.1.2)
458+
railties (7.2.2.1)
459+
actionpack (= 7.2.2.1)
460+
activesupport (= 7.2.2.1)
457461
irb (~> 1.13)
458462
rackup (>= 1.0.0)
459463
rake (>= 12.2)
@@ -464,7 +468,7 @@ GEM
464468
rb-fsevent (0.11.2)
465469
rb-inotify (0.11.1)
466470
ffi (~> 1.0)
467-
rdoc (6.8.1)
471+
rdoc (6.10.0)
468472
psych (>= 4.0.0)
469473
redis (5.3.0)
470474
redis-client (>= 0.22.0)
@@ -473,7 +477,7 @@ GEM
473477
redis-namespace (1.11.0)
474478
redis (>= 4)
475479
regexp_parser (2.9.3)
476-
reline (0.5.12)
480+
reline (0.6.0)
477481
io-console (~> 0.5)
478482
request_store (1.7.0)
479483
rack (>= 1.4)
@@ -501,7 +505,7 @@ GEM
501505
rspec-support (3.13.2)
502506
rspec_junit_formatter (0.6.0)
503507
rspec-core (>= 2, < 4, != 2.12.0)
504-
rubocop (1.69.1)
508+
rubocop (1.69.2)
505509
json (~> 2.3)
506510
language_server-protocol (>= 3.17.0)
507511
parallel (~> 1.10)
@@ -518,7 +522,7 @@ GEM
518522
rack (>= 1.1)
519523
rubocop (>= 1.52.0, < 2.0)
520524
rubocop-ast (>= 1.31.1, < 2.0)
521-
rubocop-rspec (3.2.0)
525+
rubocop-rspec (3.3.0)
522526
rubocop (~> 1.61)
523527
ruby-graphviz (1.2.5)
524528
rexml
@@ -537,7 +541,7 @@ GEM
537541
sprockets (> 3.0)
538542
sprockets-rails
539543
tilt
540-
securerandom (0.4.0)
544+
securerandom (0.4.1)
541545
selenium-webdriver (4.27.0)
542546
base64 (~> 0.2)
543547
logger (~> 1.4)
@@ -572,7 +576,7 @@ GEM
572576
thor (1.3.2)
573577
thread_safe (0.3.6)
574578
tilt (2.4.0)
575-
timeout (0.4.2)
579+
timeout (0.4.3)
576580
turbo-rails (2.0.11)
577581
actionpack (>= 6.0.0)
578582
railties (>= 6.0.0)
@@ -659,6 +663,7 @@ DEPENDENCIES
659663
pg
660664
pry
661665
puma
666+
rack-attack
662667
rack-cors
663668
rails (~> 7.2)
664669
rails-controller-testing

app/controllers/admin/forms_controller.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,7 @@ def example
237237
end
238238

239239
def js
240-
if @form.legacy_form_embed
241-
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
242-
else
243-
render(partial: 'components/widget/fba2', formats: :js, locals: { form: @form })
244-
end
240+
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
245241
end
246242

247243
def new
@@ -582,7 +578,6 @@ def form_admin_options_params
582578
:organization_id,
583579
:user_id,
584580
:template,
585-
:legacy_form_embed,
586581
:kind,
587582
:aasm_state,
588583
:early_submission,

app/controllers/submissions_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def create
2626

2727
# Catch SPAMMERS
2828
if @form && submission_params[:fba_directive].present?
29-
Rails.logger.warn("SPAM subverted from #{request.referer}")
29+
ActiveSupport::Notifications.instrument("spam_subverted") do |payload|
30+
payload[:request] = request
31+
end
32+
3033
head :ok and return
3134
end
3235

app/controllers/touchpoints_controller.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ def show
2020

2121
def js
2222
@form.increment!(:survey_form_activations)
23-
if @form.legacy_form_embed || (params[:legacy] && params[:legacy] == '1')
24-
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
25-
else
26-
render(partial: 'components/widget/fba2', formats: :js, locals: { form: @form })
27-
end
23+
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
2824
end
2925

3026
private

app/models/form.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ def duplicate!(new_user:)
225225
new_form.legacy_touchpoint_uuid = nil
226226
new_form.notification_emails = nil
227227
new_form.organization = new_user.organization
228-
new_form.legacy_form_embed = false
229228
new_form.template = false
230229
new_form.save!
231230

@@ -295,11 +294,7 @@ def deployable_form?
295294
# returns javascript text that can be used standalone
296295
# or injected into a GTM Container Tag
297296
def touchpoints_js_string
298-
if self.legacy_form_embed
299-
ApplicationController.new.render_to_string(partial: 'components/widget/fba', formats: :js, locals: { touchpoint: self })
300-
else
301-
ApplicationController.new.render_to_string(partial: 'components/widget/fba2', formats: :js, locals: { touchpoint: self })
302-
end
297+
ApplicationController.new.render_to_string(partial: 'components/widget/fba', formats: :js, locals: { form: self })
303298
end
304299

305300
def non_flagged_submissions(start_date: nil, end_date: nil)

app/views/admin/forms/_admin_options.html.erb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,6 @@
5454
</div>
5555
</fieldset>
5656
</div>
57-
<div class="grid-col-12 padding-top-2">
58-
<fieldset class="usa-fieldset">
59-
<legend class="usa-sr-only">Form Template?</legend>
60-
<div class="usa-checkbox">
61-
<%= f.check_box :legacy_form_embed, class: "usa-checkbox__input" %>
62-
<%= f.label :legacy_form_embed, class: "usa-checkbox__label" do %>
63-
Render legacy _fba.js.erb?
64-
&nbsp;
65-
<span class="usa-hint font-sans-2xs">
66-
Renders the old form as a fallback for certain clients who may have script customizations based on the old version.
67-
</span>
68-
<% end %>
69-
</div>
70-
</fieldset>
71-
</div>
7257
</div>
7358
<p class="margin-top-4">
7459
<%= f.submit (@form.persisted? ? "Update Form Admin Options " : "Create Form"), class: "usa-button" %>

0 commit comments

Comments
 (0)