Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove legacy form embed #1722

Merged
merged 7 commits into from
Dec 20, 2024
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: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ gem 'newrelic_rpm'
gem 'omniauth-github'
gem 'omniauth_login_dot_gov', git: 'https://github.com/18F/omniauth_login_dot_gov.git', branch: 'main'
gem 'omniauth-rails_csrf_protection'
gem 'rack-attack'
gem 'rack-cors', require: 'rack/cors'
# Use Redis to cache Touchpoints in all envs
gem 'redis-client'
Expand Down
147 changes: 76 additions & 71 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ GEM
aasm-diagram (0.1.3)
aasm (~> 5.0, >= 4.12)
ruby-graphviz (~> 1.2)
actioncable (7.2.1.2)
actionpack (= 7.2.1.2)
activesupport (= 7.2.1.2)
actioncable (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.1.2)
actionpack (= 7.2.1.2)
activejob (= 7.2.1.2)
activerecord (= 7.2.1.2)
activestorage (= 7.2.1.2)
activesupport (= 7.2.1.2)
actionmailbox (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
mail (>= 2.8.0)
actionmailer (7.2.1.2)
actionpack (= 7.2.1.2)
actionview (= 7.2.1.2)
activejob (= 7.2.1.2)
activesupport (= 7.2.1.2)
actionmailer (7.2.2.1)
actionpack (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activesupport (= 7.2.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.1.2)
actionview (= 7.2.1.2)
activesupport (= 7.2.1.2)
actionpack (7.2.2.1)
actionview (= 7.2.2.1)
activesupport (= 7.2.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
Expand All @@ -49,15 +49,15 @@ GEM
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.1.2)
actionpack (= 7.2.1.2)
activerecord (= 7.2.1.2)
activestorage (= 7.2.1.2)
activesupport (= 7.2.1.2)
actiontext (7.2.2.1)
actionpack (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.1.2)
activesupport (= 7.2.1.2)
actionview (7.2.2.1)
activesupport (= 7.2.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
Expand All @@ -67,23 +67,24 @@ GEM
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.2.1.2)
activesupport (= 7.2.1.2)
activejob (7.2.2.1)
activesupport (= 7.2.2.1)
globalid (>= 0.3.6)
activemodel (7.2.1.2)
activesupport (= 7.2.1.2)
activerecord (7.2.1.2)
activemodel (= 7.2.1.2)
activesupport (= 7.2.1.2)
activemodel (7.2.2.1)
activesupport (= 7.2.2.1)
activerecord (7.2.2.1)
activemodel (= 7.2.2.1)
activesupport (= 7.2.2.1)
timeout (>= 0.4.0)
activestorage (7.2.1.2)
actionpack (= 7.2.1.2)
activejob (= 7.2.1.2)
activerecord (= 7.2.1.2)
activesupport (= 7.2.1.2)
activestorage (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activesupport (= 7.2.2.1)
marcel (~> 1.0)
activesupport (7.2.1.2)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand Down Expand Up @@ -164,6 +165,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.2.0)
bcrypt (3.1.20)
benchmark (0.4.0)
bigdecimal (3.1.8)
bindata (2.5.0)
bindex (0.8.1)
Expand Down Expand Up @@ -279,7 +281,7 @@ GEM
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.8.0)
irb (1.14.1)
irb (1.14.3)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.13.0)
Expand Down Expand Up @@ -319,8 +321,8 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.2)
logstop (0.3.1)
logger (1.6.4)
logstop (0.4.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -345,7 +347,7 @@ GEM
bigdecimal (~> 3.1)
net-http (0.6.0)
uri
net-imap (0.5.1)
net-imap (0.5.2)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -356,17 +358,17 @@ GEM
net-protocol
newrelic_rpm (9.16.1)
nio4r (2.7.4)
nokogiri (1.16.8-aarch64-linux)
nokogiri (1.17.2-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.8-arm-linux)
nokogiri (1.17.2-arm-linux)
racc (~> 1.4)
nokogiri (1.16.8-arm64-darwin)
nokogiri (1.17.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.8-x86-linux)
nokogiri (1.17.2-x86-linux)
racc (~> 1.4)
nokogiri (1.16.8-x86_64-darwin)
nokogiri (1.17.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.8-x86_64-linux)
nokogiri (1.17.2-x86_64-linux)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -401,14 +403,16 @@ GEM
pry (0.15.0)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.2.1)
psych (5.2.2)
date
stringio
public_suffix (6.0.1)
puma (6.5.0)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.8)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-protection (4.1.1)
Expand All @@ -421,20 +425,20 @@ GEM
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
rails (7.2.1.2)
actioncable (= 7.2.1.2)
actionmailbox (= 7.2.1.2)
actionmailer (= 7.2.1.2)
actionpack (= 7.2.1.2)
actiontext (= 7.2.1.2)
actionview (= 7.2.1.2)
activejob (= 7.2.1.2)
activemodel (= 7.2.1.2)
activerecord (= 7.2.1.2)
activestorage (= 7.2.1.2)
activesupport (= 7.2.1.2)
rails (7.2.2.1)
actioncable (= 7.2.2.1)
actionmailbox (= 7.2.2.1)
actionmailer (= 7.2.2.1)
actionpack (= 7.2.2.1)
actiontext (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activemodel (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
bundler (>= 1.15.0)
railties (= 7.2.1.2)
railties (= 7.2.2.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -448,12 +452,12 @@ GEM
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.6.1)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
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)
railties (7.2.1.2)
actionpack (= 7.2.1.2)
activesupport (= 7.2.1.2)
railties (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
Expand All @@ -464,7 +468,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.8.1)
rdoc (6.10.0)
psych (>= 4.0.0)
redis (5.3.0)
redis-client (>= 0.22.0)
Expand All @@ -473,7 +477,7 @@ GEM
redis-namespace (1.11.0)
redis (>= 4)
regexp_parser (2.9.3)
reline (0.5.12)
reline (0.6.0)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
Expand Down Expand Up @@ -501,7 +505,7 @@ GEM
rspec-support (3.13.2)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.69.1)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -518,7 +522,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.2.0)
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
ruby-graphviz (1.2.5)
rexml
Expand All @@ -537,7 +541,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
securerandom (0.4.0)
securerandom (0.4.1)
selenium-webdriver (4.27.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand Down Expand Up @@ -572,7 +576,7 @@ GEM
thor (1.3.2)
thread_safe (0.3.6)
tilt (2.4.0)
timeout (0.4.2)
timeout (0.4.3)
turbo-rails (2.0.11)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -659,6 +663,7 @@ DEPENDENCIES
pg
pry
puma
rack-attack
rack-cors
rails (~> 7.2)
rails-controller-testing
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/admin/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,7 @@ def example
end

def js
if @form.legacy_form_embed
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
else
render(partial: 'components/widget/fba2', formats: :js, locals: { form: @form })
end
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
end

def new
Expand Down Expand Up @@ -582,7 +578,6 @@ def form_admin_options_params
:organization_id,
:user_id,
:template,
:legacy_form_embed,
:kind,
:aasm_state,
:early_submission,
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def create

# Catch SPAMMERS
if @form && submission_params[:fba_directive].present?
Rails.logger.warn("SPAM subverted from #{request.referer}")
ActiveSupport::Notifications.instrument("spam_subverted") do |payload|
payload[:request] = request
end

head :ok and return
end

Expand Down
6 changes: 1 addition & 5 deletions app/controllers/touchpoints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ def show

def js
@form.increment!(:survey_form_activations)
if @form.legacy_form_embed || (params[:legacy] && params[:legacy] == '1')
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
else
render(partial: 'components/widget/fba2', formats: :js, locals: { form: @form })
end
render(partial: 'components/widget/fba', formats: :js, locals: { form: @form })
end

private
Expand Down
7 changes: 1 addition & 6 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def duplicate!(new_user:)
new_form.legacy_touchpoint_uuid = nil
new_form.notification_emails = nil
new_form.organization = new_user.organization
new_form.legacy_form_embed = false
new_form.template = false
new_form.save!

Expand Down Expand Up @@ -295,11 +294,7 @@ def deployable_form?
# returns javascript text that can be used standalone
# or injected into a GTM Container Tag
def touchpoints_js_string
if self.legacy_form_embed
ApplicationController.new.render_to_string(partial: 'components/widget/fba', formats: :js, locals: { touchpoint: self })
else
ApplicationController.new.render_to_string(partial: 'components/widget/fba2', formats: :js, locals: { touchpoint: self })
end
ApplicationController.new.render_to_string(partial: 'components/widget/fba', formats: :js, locals: { form: self })
end

def non_flagged_submissions(start_date: nil, end_date: nil)
Expand Down
15 changes: 0 additions & 15 deletions app/views/admin/forms/_admin_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@
</div>
</fieldset>
</div>
<div class="grid-col-12 padding-top-2">
<fieldset class="usa-fieldset">
<legend class="usa-sr-only">Form Template?</legend>
<div class="usa-checkbox">
<%= f.check_box :legacy_form_embed, class: "usa-checkbox__input" %>
<%= f.label :legacy_form_embed, class: "usa-checkbox__label" do %>
Render legacy _fba.js.erb?
&nbsp;
<span class="usa-hint font-sans-2xs">
Renders the old form as a fallback for certain clients who may have script customizations based on the old version.
</span>
<% end %>
</div>
</fieldset>
</div>
</div>
<p class="margin-top-4">
<%= f.submit (@form.persisted? ? "Update Form Admin Options " : "Create Form"), class: "usa-button" %>
Expand Down
Loading
Loading