diff --git a/.circleci/config.yml b/.circleci/config.yml index 242aa4569..beab365f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ orbs: jobs: build: docker: - - image: cimg/ruby:3.3.4-browsers + - image: cimg/ruby:3.4.5-browsers environment: RAILS_ENV: test PGHOST: 127.0.0.1 diff --git a/.gitignore b/.gitignore index 5b52b74cf..a7ab3c368 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,9 @@ /coverage/ +# Ignore RSpec example status persistence file +/spec/examples.txt + /public/packs /public/packs-test /node_modules diff --git a/.rspec b/.rspec index 49d5710b3..f570ea6f6 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --format documentation +--profile 10 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..132d9f770 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.8 \ No newline at end of file diff --git a/Gemfile b/Gemfile index d4352ce40..717259aa9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.3.4' +ruby '3.2.8' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '~> 8.0' @@ -31,7 +31,7 @@ gem 'stimulus-rails' # gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] +gem 'tzinfo-data', platforms: %i[windows jruby] # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', require: false @@ -63,20 +63,16 @@ gem 'omniauth_login_dot_gov', git: 'https://github.com/18F/omniauth_login_dot_go gem 'omniauth-rails_csrf_protection' gem 'rack-attack' gem 'rack-cors', '>= 3.0.0', require: 'rack/cors' -# Use Redis to cache Touchpoints in all envs= +# Use Redis to cache Touchpoints in all envs gem 'redis-client' gem 'redis-namespace' gem 'sidekiq', '>= 8.0.4' gem 'json-jwt' gem 'aasm' gem 'acts-as-taggable-on' -gem 'json-jwt' gem 'logstop' gem 'paper_trail' -gem 'redis-client' -gem 'redis-namespace' gem 'rolify' -gem 'sidekiq', '>= 6.5.0' group :development, :test do gem 'dotenv' diff --git a/Gemfile.lock b/Gemfile.lock index 2f9c31343..501599281 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,29 +18,29 @@ GEM aasm-diagram (0.1.3) aasm (~> 5.0, >= 4.12) ruby-graphviz (~> 1.2) - actioncable (8.0.2) - actionpack (= 8.0.2) - activesupport (= 8.0.2) + actioncable (8.0.2.1) + actionpack (= 8.0.2.1) + activesupport (= 8.0.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.2) - actionpack (= 8.0.2) - activejob (= 8.0.2) - activerecord (= 8.0.2) - activestorage (= 8.0.2) - activesupport (= 8.0.2) + actionmailbox (8.0.2.1) + actionpack (= 8.0.2.1) + activejob (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) mail (>= 2.8.0) - actionmailer (8.0.2) - actionpack (= 8.0.2) - actionview (= 8.0.2) - activejob (= 8.0.2) - activesupport (= 8.0.2) + actionmailer (8.0.2.1) + actionpack (= 8.0.2.1) + actionview (= 8.0.2.1) + activejob (= 8.0.2.1) + activesupport (= 8.0.2.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.2) - actionview (= 8.0.2) - activesupport (= 8.0.2) + actionpack (8.0.2.1) + actionview (= 8.0.2.1) + activesupport (= 8.0.2.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -48,15 +48,15 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.2) - actionpack (= 8.0.2) - activerecord (= 8.0.2) - activestorage (= 8.0.2) - activesupport (= 8.0.2) + actiontext (8.0.2.1) + actionpack (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.2) - activesupport (= 8.0.2) + actionview (8.0.2.1) + activesupport (= 8.0.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -66,22 +66,22 @@ GEM activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (8.0.2) - activesupport (= 8.0.2) + activejob (8.0.2.1) + activesupport (= 8.0.2.1) globalid (>= 0.3.6) - activemodel (8.0.2) - activesupport (= 8.0.2) - activerecord (8.0.2) - activemodel (= 8.0.2) - activesupport (= 8.0.2) + activemodel (8.0.2.1) + activesupport (= 8.0.2.1) + activerecord (8.0.2.1) + activemodel (= 8.0.2.1) + activesupport (= 8.0.2.1) timeout (>= 0.4.0) - activestorage (8.0.2) - actionpack (= 8.0.2) - activejob (= 8.0.2) - activerecord (= 8.0.2) - activesupport (= 8.0.2) + activestorage (8.0.2.1) + actionpack (= 8.0.2.1) + activejob (= 8.0.2.1) + activerecord (= 8.0.2.1) + activesupport (= 8.0.2.1) marcel (~> 1.0) - activesupport (8.0.2) + activesupport (8.0.2.1) base64 benchmark (>= 0.3) bigdecimal @@ -107,8 +107,8 @@ GEM aws-sdk-ses (~> 1, >= 1.50.0) aws-sdk-sesv2 (~> 1, >= 1.34.0) aws-eventstream (1.4.0) - aws-partitions (1.1140.0) - aws-sdk-core (3.228.0) + aws-partitions (1.1154.0) + aws-sdk-core (3.232.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -116,21 +116,21 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-kms (1.109.0) - aws-sdk-core (~> 3, >= 3.228.0) + aws-sdk-kms (1.112.0) + aws-sdk-core (~> 3, >= 3.231.0) aws-sigv4 (~> 1.5) aws-sdk-rails (5.1.0) aws-sdk-core (~> 3) railties (>= 7.1.0) - aws-sdk-s3 (1.195.0) - aws-sdk-core (~> 3, >= 3.228.0) + aws-sdk-s3 (1.198.0) + aws-sdk-core (~> 3, >= 3.231.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sdk-ses (1.87.0) - aws-sdk-core (~> 3, >= 3.228.0) + aws-sdk-ses (1.90.0) + aws-sdk-core (~> 3, >= 3.231.0) aws-sigv4 (~> 1.5) - aws-sdk-sesv2 (1.81.0) - aws-sdk-core (~> 3, >= 3.228.0) + aws-sdk-sesv2 (1.85.0) + aws-sdk-core (~> 3, >= 3.231.0) aws-sigv4 (~> 1.5) aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) @@ -147,10 +147,10 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - base64 (0.2.0) + base64 (0.3.0) bcrypt (3.1.20) benchmark (0.4.1) - bigdecimal (3.2.2) + bigdecimal (3.2.3) bindata (2.5.1) bindex (0.8.1) bootsnap (1.18.6) @@ -187,7 +187,7 @@ GEM coercible (1.0.0) descendants_tracker (~> 0.0.1) concurrent-ruby (1.3.5) - connection_pool (2.5.3) + connection_pool (2.5.4) crass (1.0.6) csv (3.3.5) database_cleaner (2.1.0) @@ -212,9 +212,9 @@ GEM dumb_delegator (1.1.0) erb (5.0.2) erubi (1.13.1) - excon (1.2.8) + excon (1.3.0) logger - factory_bot (6.5.4) + factory_bot (6.5.5) activesupport (>= 6.1.0) factory_bot_rails (6.5.0) factory_bot (~> 6.5) @@ -234,13 +234,11 @@ GEM ffi (1.17.2-arm-linux-gnu) ffi (1.17.2-arm-linux-musl) ffi (1.17.2-arm64-darwin) - ffi (1.17.2-x86-linux-gnu) - ffi (1.17.2-x86-linux-musl) ffi (1.17.2-x86_64-darwin) ffi (1.17.2-x86_64-linux-gnu) ffi (1.17.2-x86_64-linux-musl) - fog-aws (3.32.0) - base64 (~> 0.2.0) + fog-aws (3.33.0) + base64 (>= 0.2, < 0.4) fog-core (~> 2.6) fog-json (~> 1.1) fog-xml (~> 0.1) @@ -255,7 +253,8 @@ GEM fog-xml (0.1.5) fog-core nokogiri (>= 1.5.11, < 2.0.0) - formatador (1.1.1) + formatador (1.2.0) + reline globalid (1.2.1) activesupport (>= 6.1) hashie (5.0.0) @@ -274,16 +273,16 @@ GEM pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.13.0) - actionview (>= 5.0.0) - activesupport (>= 5.0.0) + jbuilder (2.14.1) + actionview (>= 7.0.0) + activesupport (>= 7.0.0) jmespath (1.6.2) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.13.2) - json-jwt (1.16.7) + json-jwt (1.17.0) activesupport (>= 4.2) aes_key_wrap base64 @@ -329,11 +328,10 @@ GEM mime-types (3.7.0) logger mime-types-data (~> 3.2025, >= 3.2025.0507) - mime-types-data (3.2025.0729) - mini_magick (5.3.0) + mime-types-data (3.2025.0902) + mini_magick (5.3.1) logger mini_mime (1.1.5) - mini_portile2 (2.8.9) minitest (5.25.5) msgpack (1.8.0) multi_json (1.17.0) @@ -341,7 +339,7 @@ GEM bigdecimal (~> 3.1) net-http (0.6.0) uri - net-imap (0.5.9) + net-imap (0.5.10) date net-protocol net-pop (0.1.2) @@ -350,11 +348,8 @@ GEM timeout net-smtp (0.5.1) net-protocol - newrelic_rpm (9.20.0) + newrelic_rpm (9.21.0) nio4r (2.7.4) - nokogiri (1.18.9) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) nokogiri (1.18.9-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.9-aarch64-linux-musl) @@ -371,14 +366,14 @@ GEM racc (~> 1.4) nokogiri (1.18.9-x86_64-linux-musl) racc (~> 1.4) - oauth2 (2.0.12) + oauth2 (2.0.14) faraday (>= 0.17.3, < 4.0) jwt (>= 1.0, < 4.0) logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) snaky_hash (~> 2.0, >= 2.0.3) - version_gem (>= 1.1.8, < 3) + version_gem (~> 1.1, >= 1.1.8) omniauth (2.1.3) hashie (>= 3.4.6) rack (>= 2.2.3) @@ -401,11 +396,13 @@ GEM parser (3.3.9.0) ast (~> 2.4.1) racc - pg (1.6.0) - pg (1.6.0-aarch64-linux) - pg (1.6.0-arm64-darwin) - pg (1.6.0-x86_64-darwin) - pg (1.6.0-x86_64-linux) + pg (1.6.2) + pg (1.6.2-aarch64-linux) + pg (1.6.2-aarch64-linux-musl) + pg (1.6.2-arm64-darwin) + pg (1.6.2-x86_64-darwin) + pg (1.6.2-x86_64-linux) + pg (1.6.2-x86_64-linux-musl) pp (0.6.2) prettyprint prettyprint (0.2.0) @@ -420,7 +417,7 @@ GEM puma (6.6.1) nio4r (~> 2.0) racc (1.8.1) - rack (3.2.0) + rack (3.2.1) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (3.0.0) @@ -437,20 +434,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.2) - actioncable (= 8.0.2) - actionmailbox (= 8.0.2) - actionmailer (= 8.0.2) - actionpack (= 8.0.2) - actiontext (= 8.0.2) - actionview (= 8.0.2) - activejob (= 8.0.2) - activemodel (= 8.0.2) - activerecord (= 8.0.2) - activestorage (= 8.0.2) - activesupport (= 8.0.2) + rails (8.0.2.1) + actioncable (= 8.0.2.1) + actionmailbox (= 8.0.2.1) + actionmailer (= 8.0.2.1) + actionpack (= 8.0.2.1) + actiontext (= 8.0.2.1) + actionview (= 8.0.2.1) + activejob (= 8.0.2.1) + activemodel (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) bundler (>= 1.15.0) - railties (= 8.0.2) + railties (= 8.0.2.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -467,9 +464,9 @@ GEM 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 (8.0.2) - actionpack (= 8.0.2) - activesupport (= 8.0.2) + railties (8.0.2.1) + actionpack (= 8.0.2.1) + activesupport (= 8.0.2.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -485,11 +482,11 @@ GEM psych (>= 4.0.0) redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.25.1) + redis-client (0.25.2) connection_pool redis-namespace (1.11.0) redis (>= 4) - regexp_parser (2.10.0) + regexp_parser (2.11.2) reline (0.6.2) io-console (~> 0.5) request_store (1.7.0) @@ -497,7 +494,7 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.4.1) + rexml (3.4.2) rolify (6.0.1) rspec-core (3.13.5) rspec-support (~> 3.13.0) @@ -507,7 +504,7 @@ GEM rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (8.0.1) + rspec-rails (8.0.2) actionpack (>= 7.2) activesupport (>= 7.2) railties (>= 7.2) @@ -515,10 +512,10 @@ GEM rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) - rspec-support (3.13.4) + rspec-support (3.13.5) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.79.1) + rubocop (1.80.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -532,22 +529,22 @@ GEM rubocop-ast (1.46.0) parser (>= 3.3.7.2) prism (~> 1.4) - rubocop-rails (2.32.0) + rubocop-rails (2.33.3) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.44.0, < 2.0) - rubocop-rspec (3.6.0) + rubocop-rspec (3.7.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) ruby-graphviz (1.2.5) rexml ruby-progressbar (1.13.0) - ruby-vips (2.2.4) + ruby-vips (2.2.5) ffi (~> 1.12) logger - rubyzip (2.4.1) + rubyzip (3.0.2) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) @@ -557,13 +554,13 @@ GEM sprockets-rails tilt securerandom (0.4.1) - selenium-webdriver (4.34.0) + selenium-webdriver (4.35.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) - sidekiq (8.0.6) + sidekiq (8.0.7) connection_pool (>= 2.5.0) json (>= 2.9.0) logger (>= 1.6.2) @@ -599,13 +596,13 @@ GEM railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.4) + unicode-display_width (3.1.5) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) - uniform_notifier (1.17.0) + uniform_notifier (1.18.0) uri (1.0.3) useragent (0.16.11) - version_gem (1.1.8) + version_gem (1.1.9) virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) @@ -630,13 +627,9 @@ PLATFORMS aarch64-linux aarch64-linux-gnu aarch64-linux-musl - arm-linux arm-linux-gnu arm-linux-musl arm64-darwin - x86-linux - x86-linux-gnu - x86-linux-musl x86_64-darwin x86_64-linux x86_64-linux-gnu @@ -685,7 +678,7 @@ DEPENDENCIES pry puma rack-attack - rack-cors + rack-cors (>= 3.0.0) rails (~> 8.0) rails-controller-testing rails-erd @@ -694,11 +687,11 @@ DEPENDENCIES rolify rspec-rails (>= 8.0.1) rspec_junit_formatter - rubocop-rails + rubocop-rails (>= 2.32.0) rubocop-rspec sassc-rails selenium-webdriver - sidekiq (>= 6.5.0) + sidekiq (>= 8.0.4) simplecov sprockets-rails stimulus-rails @@ -707,7 +700,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.3.4p94 + ruby 3.4.5p51 BUNDLED WITH - 2.5.16 + 2.7.1 diff --git a/app/controllers/admin/cx_collection_details_controller.rb b/app/controllers/admin/cx_collection_details_controller.rb index 54b2b399b..e7ef08e6a 100644 --- a/app/controllers/admin/cx_collection_details_controller.rb +++ b/app/controllers/admin/cx_collection_details_controller.rb @@ -55,8 +55,8 @@ def create format.html { redirect_to upload_admin_cx_collection_detail_url(@cx_collection_detail), notice: "CX Collection Detail was successfully created." } format.json { render :upload, status: :created, location: @cx_collection_detail } else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @cx_collection_detail.errors, status: :unprocessable_entity } + format.html { render :new, status: :unprocessable_content } + format.json { render json: @cx_collection_detail.errors, status: :unprocessable_content } end end end @@ -67,8 +67,8 @@ def update format.html { redirect_to admin_cx_collection_detail_url(@cx_collection_detail), notice: "CX Collection Detail was successfully updated." } format.json { render :show, status: :ok, location: @cx_collection_detail } else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @cx_collection_detail.errors, status: :unprocessable_entity } + format.html { render :edit, status: :unprocessable_content } + format.json { render json: @cx_collection_detail.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/admin/cx_collections_controller.rb b/app/controllers/admin/cx_collections_controller.rb index 22f41a9c4..fb60b44ca 100644 --- a/app/controllers/admin/cx_collections_controller.rb +++ b/app/controllers/admin/cx_collections_controller.rb @@ -65,8 +65,8 @@ def create format.html { redirect_to admin_cx_collection_url(@cx_collection), notice: "CX Data Collection was successfully created." } format.json { render :show, status: :created, location: @cx_collection } else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @cx_collection.errors, status: :unprocessable_entity } + format.html { render :new, status: :unprocessable_content } + format.json { render json: @cx_collection.errors, status: :unprocessable_content } end end end @@ -129,7 +129,7 @@ def copy format.json { render :show, status: :created, location: new_collection } else format.html { render :new } - format.json { render json: new_collection.errors, status: :unprocessable_entity } + format.json { render json: new_collection.errors, status: :unprocessable_content } end end end @@ -143,8 +143,8 @@ def update format.html { redirect_to admin_cx_collection_url(@cx_collection), notice: "CX Data Collection was successfully updated." } format.json { render :show, status: :ok, location: @cx_collection } else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @cx_collection.errors, status: :unprocessable_entity } + format.html { render :edit, status: :unprocessable_content } + format.json { render json: @cx_collection.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/admin/digital_product_versions_controller.rb b/app/controllers/admin/digital_product_versions_controller.rb index e457f57c4..72b253d12 100644 --- a/app/controllers/admin/digital_product_versions_controller.rb +++ b/app/controllers/admin/digital_product_versions_controller.rb @@ -25,7 +25,7 @@ def create if @digital_product_version.save redirect_to admin_digital_product_digital_product_versions_path(@digital_product) else - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end @@ -35,7 +35,7 @@ def update if @digital_product_version.update(digital_product_version_params) redirect_to admin_digital_product_digital_product_versions_path(@digital_product) else - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end diff --git a/app/controllers/admin/forms_controller.rb b/app/controllers/admin/forms_controller.rb index 36c6d4193..178fd7ade 100644 --- a/app/controllers/admin/forms_controller.rb +++ b/app/controllers/admin/forms_controller.rb @@ -36,6 +36,9 @@ class FormsController < AdminController # Maximum number of rows that may be exported to csv MAX_ROWS_TO_EXPORT = 300_000 + + # Maximum number of questions supported per form + MAX_QUESTIONS = 30 def index if form_search_params[:aasm_state].present? @@ -286,8 +289,8 @@ def create format.html { redirect_to questions_admin_form_path(@form), notice: 'Form was successfully created.' } format.json { render :show, status: :created, location: @form } else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @form.errors, status: :unprocessable_entity } + format.html { render :new, status: :unprocessable_content } + format.json { render json: @form.errors, status: :unprocessable_content } end end end @@ -308,8 +311,8 @@ def copy format.html { redirect_to admin_form_path(new_form), notice: 'Form was successfully copied.' } format.json { render :show, status: :created, location: new_form } else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: new_form.errors, status: :unprocessable_entity } + format.html { render :new, status: :unprocessable_content } + format.json { render json: new_form.errors, status: :unprocessable_content } end end end @@ -330,8 +333,8 @@ def update end format.json { render :show, status: :ok, location: @form } else - format.html { render (params[:form][:delivery_method].present? ? :delivery : :edit), status: :unprocessable_entity } - format.json { render json: @form.errors, status: :unprocessable_entity } + format.html { render (params[:form][:delivery_method].present? ? :delivery : :edit), status: :unprocessable_content } + format.json { render json: @form.errors, status: :unprocessable_content } end end end @@ -382,7 +385,7 @@ def add_user form: @form.short_uuid, } else - render json: @role.errors, status: :unprocessable_entity + render json: @role.errors, status: :unprocessable_content end end @@ -398,7 +401,7 @@ def remove_user form: @form.short_uuid, } else - render json: @role.errors, status: :unprocessable_entity + render json: @role.errors, status: :unprocessable_content end end @@ -528,26 +531,7 @@ def form_params :load_css, :tag_list, :verify_csrf, - :question_text_01, - :question_text_02, - :question_text_03, - :question_text_04, - :question_text_05, - :question_text_06, - :question_text_07, - :question_text_08, - :question_text_09, - :question_text_10, - :question_text_11, - :question_text_12, - :question_text_13, - :question_text_14, - :question_text_15, - :question_text_16, - :question_text_17, - :question_text_18, - :question_text_19, - :question_text_20, + *((1..MAX_QUESTIONS).map { |i| :"question_text_#{i.to_s.rjust(2, '0')}" }), ) end diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index 0e36a141b..29e0f9143 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -57,7 +57,7 @@ def create format.json { render :show, status: :created, location: @organization } else format.html { render :new } - format.json { render json: @organization.errors, status: :unprocessable_entity } + format.json { render json: @organization.errors, status: :unprocessable_content } end end end @@ -72,7 +72,7 @@ def update format.json { render :show, status: :ok, location: @organization } else format.html { render :edit } - format.json { render json: @organization.errors, status: :unprocessable_entity } + format.json { render json: @organization.errors, status: :unprocessable_content } end end end @@ -86,7 +86,7 @@ def performance_update format.json { render :show, status: :ok, location: @organization } else format.html { render :edit } - format.json { render json: @organization.errors, status: :unprocessable_entity } + format.json { render json: @organization.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 3c938804c..d75dddcf5 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -36,7 +36,7 @@ def create format.json { render json: @question } else format.html { render :new } - format.json { render json: @question.errors, status: :unprocessable_entity } + format.json { render json: @question.errors, status: :unprocessable_content } end end end @@ -47,7 +47,7 @@ def update if @question.update(question_params) format.json { render json: @question } else - format.json { render json: @question.errors, status: :unprocessable_entity } + format.json { render json: @question.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/admin/submissions_controller.rb b/app/controllers/admin/submissions_controller.rb index 41bb20ba7..95b013e62 100644 --- a/app/controllers/admin/submissions_controller.rb +++ b/app/controllers/admin/submissions_controller.rb @@ -38,7 +38,7 @@ def update format.html do redirect_to admin_form_submission_path(@form, @submission), alert: 'Response could not be updated.' end - format.json { render json: @form.errors, status: :unprocessable_entity } + format.json { render json: @form.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 6e603c3dc..067a56619 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -73,7 +73,7 @@ def create format.json { render :show, status: :created, location: @user } else format.html { render :new } - format.json { render json: @user.errors, status: :unprocessable_entity } + format.json { render json: @user.errors, status: :unprocessable_content } end end end @@ -86,7 +86,7 @@ def update format.json { render :show, status: :ok, location: @user } else format.html { render :edit } - format.json { render json: @user.errors, status: :unprocessable_entity } + format.json { render json: @user.errors, status: :unprocessable_content } end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index be75124e6..21c5dd15f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -272,7 +272,7 @@ def paginate(scope, default_per_page = 20) # customized response for `#verify_authenticity_token` def handle_unverified_request - render json: { messages: { submission: ['invalid CSRF authenticity token'] } }, status: :unprocessable_entity + render json: { messages: { submission: ['invalid CSRF authenticity token'] } }, status: :unprocessable_content end private diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 2b40db392..a6d8df2a1 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -9,7 +9,7 @@ def update if current_user.update(user_params) redirect_to profile_path, notice: 'User profile updated' else - render :show, status: :unprocessable_entity + render :show, status: :unprocessable_content end end diff --git a/app/models/form.rb b/app/models/form.rb index dc1af4ae7..4dab61091 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -900,7 +900,7 @@ def ensure_a11_v2_radio_format end def warn_about_not_too_many_questions - if questions.size >= 30 + if questions.size > 20 errors.add(:base, "Touchpoints supports a maximum of 30 questions. There are currently #{questions_count} questions. Fewer questions tend to yield higher response rates.") end end diff --git a/app/views/components/forms/question_types/_big_thumbs_up_down_buttons.html.erb b/app/views/components/forms/question_types/_big_thumbs_up_down_buttons.html.erb index 94c8f09fa..6cad5fe99 100644 --- a/app/views/components/forms/question_types/_big_thumbs_up_down_buttons.html.erb +++ b/app/views/components/forms/question_types/_big_thumbs_up_down_buttons.html.erb @@ -34,6 +34,7 @@ class="usa-banner__lock-image" role="img" focusable="false" + aria-labelledby="thumbs-up-icon" >