diff --git a/.circleci/config.yml b/.circleci/config.yml index 79198f40dc..7051d643e7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ defaults: &defaults CIRCLE_TEST_REPORTS: /tmp/circleci-test-results docker: # List of image tags: https://circleci.com/developer/images/image/cimg/ruby#image-tags - - image: cimg/ruby:2.6.10-browsers + - image: cimg/ruby:3.1.4-browsers environment: PGHOST: 127.0.0.1 PGUSER: circleci @@ -53,18 +53,26 @@ jobs: - v1-dep-main- - v1-dep- - run: - name: Update to Node v16.14.2 + name: Swap node versions command: | - curl -sSL "https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz" | sudo tar --strip-components=2 -xJ -C /usr/local/bin/ node-v16.14.2-linux-x64/bin/node - curl https://www.npmjs.com/install.sh | sudo bash + set +e + wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + nvm install v16.14 + nvm alias default 16.14 + + echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV - run: gem install bundler - run: bundle install --path=vendor/bundle --jobs=4 --retry=3 - run: yarn install --cache-folder ~/.cache/yarn - run: name: Setup Chrome command: | - sudo apt-get update - sudo apt-get install libu2f-udev + wget http://archive.ubuntu.com/ubuntu/pool/main/libu/libu2f-host/libu2f-udev_1.1.4-1_all.deb + sudo dpkg -i libu2f-udev_1.1.4-1_all.deb wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i ./google-chrome*.deb sudo apt-get install @@ -75,6 +83,11 @@ jobs: - ./node_modules - ./vendor/bundle - run: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: Download libssl1.1 + command: | + wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb + sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb - run: command: bundle exec rake db:create db:schema:load --trace environment: @@ -82,20 +95,13 @@ jobs: RACK_ENV: test - run: RAILS_ENV=test bundle exec rake db:create db:schema:load - run: RAILS_ENV=test bundle exec rake react_on_rails:locale + - run: RAILS_ENV=test bundle exec rails assets:precompile - run: name: Run React Jest Tests command: | set -e (cd client && yarn lint:flow && yarn lint:eslint && yarn test:circleci) (cd client && ../tmp/cc-test-reporter format-coverage -t lcov -o ../tmp/codeclimate.frontend.json coverage/lcov.info) - - run: - name: Run YAML linter - command: | - set -e - curl https://bootstrap.pypa.io/pip/3.5/get-pip.py -o get-pip.py - python3 get-pip.py --user - python3 -m pip install --user yamllint - cd config && yamllint locales/ - persist_to_workspace: root: tmp paths: diff --git a/.ruby-version b/.ruby-version index a04abec914..0aec50e6ed 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.10 +3.1.4 diff --git a/Dockerfile b/Dockerfile index a0ba5094f0..323a147b27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.6.10 +FROM ruby:3.1.4 RUN apt-get update -qq && \ apt-get install -y build-essential cmake git tzdata libpq-dev ruby-dev curl diff --git a/Gemfile b/Gemfile index ca10fa3474..b7cefd0147 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ # frozen_string_literal: true source 'https://rubygems.org' -ruby '~> 2.6.10' +ruby '~> 3.1.4' -gem 'puma' +gem 'puma', '5.6.4' # Latest capybara doesn't work with puma 6.0 at the moment. gem 'rack-rewrite' -gem 'rails', '~> 6.0.4.8' +gem 'rails', '~> 7.0.4.3' gem 'activerecord-import' gem 'bcrypt', '3.1.13' @@ -28,8 +28,7 @@ gem 'uglifier', '~> 4.1.20' gem 'carrierwave', '~> 1.3.1' gem 'certified', '1.0.0' gem 'chronic', '0.10.2' -gem 'cloudinary', '~> 1.21.0' -gem 'figaro', '1.1.1' +gem 'cloudinary', '~> 1.25.0' gem 'google-api-client', '~> 0.53.0' gem 'kaminari', '1.2.1' gem 'omniauth', '~> 2.0' @@ -38,7 +37,7 @@ gem 'omniauth-google-oauth2', '~> 1.0.1' gem 'omniauth-rails_csrf_protection', '~> 1.0.1' gem 'premailer-rails' gem 'pusher', '1.3.3' -gem 'rails-i18n', '~> 6.0.0' +gem 'rails-i18n', '~> 7.0.5' gem 'friendly_id', '~> 5.2.5' gem 'sdoc', '1.0.0', group: :doc @@ -46,19 +45,21 @@ gem 'sdoc', '1.0.0', group: :doc gem 'font-awesome-sass' gem 'inline_svg' -gem 'groupdate', '4.1.2' +gem 'groupdate', '~> 6.1' gem 'react_on_rails', '12.0.1' -gem 'webpacker', '5.1.1' +gem 'webpacker' gem 'selenium-webdriver', '~> 4.1.0' gem 'rubyzip', '~> 1.3.0' -gem 'sidekiq', '6.4.0' +gem 'sidekiq' gem 'sidekiq-middleware' gem 'sidekiq-failures' gem "sidekiq-cron", "~> 1.1" +gem 'net-smtp', require: false # this is a rails 6 fix and will go away soon. +gem "sprockets-rails" group :development, :test do gem 'bundler-audit' @@ -66,7 +67,7 @@ group :development, :test do gem 'spring' - gem 'annotate', '~> 2.7' + gem 'annotate', '~> 3.2.0' gem 'railroady', '1.5.3' gem 'rails-erd', '~> 1.6' @@ -76,7 +77,7 @@ group :development, :test do gem 'pry-rails' gem 'rack-mini-profiler' - gem 'capybara', '~> 3.24.0' + gem 'capybara', '~> 3.37.0' gem 'factory_bot_rails' gem 'rspec-collection_matchers', '~> 1.1.3' gem 'rspec-html-matchers', '~> 0.9.0' @@ -85,7 +86,7 @@ group :development, :test do gem 'letter_opener' gem 'rspec_junit_formatter' - gem 'rubocop', '~> 0.80.1' + gem 'rubocop' gem 'rubocop-performance' gem 'rubocop-rails' gem 'rubocop-rspec' @@ -102,8 +103,8 @@ end group :test do gem 'database_cleaner' gem 'rails-controller-testing' - gem 'shoulda-matchers' - gem 'simplecov', '0.16.1' + gem 'shoulda-matchers', '~> 5.3.0' + gem 'simplecov', '~> 0.17.0' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 33ce0aa55a..97974cb6b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,90 +1,101 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.4.8) - actionpack (= 6.0.4.8) + actioncable (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.4.8) - actionpack (= 6.0.4.8) - activejob (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) + actionmailbox (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (>= 2.7.1) - actionmailer (6.0.4.8) - actionpack (= 6.0.4.8) - actionview (= 6.0.4.8) - activejob (= 6.0.4.8) + net-imap + net-pop + net-smtp + actionmailer (7.0.4.3) + actionpack (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.0.4.8) - actionview (= 6.0.4.8) - activesupport (= 6.0.4.8) - rack (~> 2.0, >= 2.0.8) + actionpack (7.0.4.3) + actionview (= 7.0.4.3) + activesupport (= 7.0.4.3) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4.8) - actionpack (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) + actiontext (7.0.4.3) + actionpack (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.0.4.8) - activesupport (= 6.0.4.8) + actionview (7.0.4.3) + activesupport (= 7.0.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.4.8) - activesupport (= 6.0.4.8) + activejob (7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.3.6) - activemodel (6.0.4.8) - activesupport (= 6.0.4.8) - activerecord (6.0.4.8) - activemodel (= 6.0.4.8) - activesupport (= 6.0.4.8) - activerecord-import (1.0.6) - activerecord (>= 3.2) - activestorage (6.0.4.8) - actionpack (= 6.0.4.8) - activejob (= 6.0.4.8) - activerecord (= 6.0.4.8) - marcel (~> 1.0.0) - activesupport (6.0.4.8) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activerecord-import (1.4.1) + activerecord (>= 4.2) + activestorage (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activesupport (= 7.0.4.3) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - annotate (2.7.5) - activerecord (>= 3.2, < 7.0) - rake (>= 10.4, < 13.0) - ast (2.4.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) + ast (2.4.2) aws_cf_signer (0.1.3) bcrypt (3.1.13) - better_errors (2.8.3) + better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) builder (3.2.4) - bullet (6.1.0) + bullet (7.0.3) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - bundler-audit (0.7.0.1) + bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) - thor (>= 0.18, < 2) + thor (~> 1.0) byebug (11.1.3) - capybara (3.24.0) + capybara (3.37.1) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) carrierwave (1.3.2) activemodel (>= 4.0.0) @@ -95,16 +106,21 @@ GEM childprocess (4.1.0) choice (0.2.0) chronic (0.10.2) - cloudinary (1.21.0) + cloudinary (1.25.0) aws_cf_signer rest-client (>= 2.0.0) coderay (1.1.3) concurrent-ruby (1.2.0) - connection_pool (2.2.5) + connection_pool (2.3.0) crass (1.0.6) - css_parser (1.7.1) + css_parser (1.12.0) addressable - database_cleaner (1.8.5) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) declarative (0.0.20) devise (4.8.1) bcrypt (~> 3.0) @@ -115,14 +131,14 @@ GEM devise-pwned_password (0.1.9) devise (~> 4) pwned (~> 2.0.0) - devise_invitable (2.0.6) + devise_invitable (2.0.7) actionmailer (>= 5.0) devise (>= 4.6) devise_uid (0.1.1) devise (>= 3.0.0) railties (>= 3.0) - diff-lcs (1.4.4) - docile (1.3.2) + diff-lcs (1.5.0) + docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) @@ -130,34 +146,34 @@ GEM dotenv (= 2.7.6) railties (>= 3.2) erubi (1.11.0) - et-orbi (1.2.4) + et-orbi (1.2.7) tzinfo - execjs (2.7.0) - factory_bot (6.1.0) + execjs (2.8.1) + factory_bot (6.2.1) activesupport (>= 5.0.0) - factory_bot_rails (6.1.0) - factory_bot (~> 6.1.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (0.17.5) - multipart-post (>= 1.2, < 3) + faraday (2.6.0) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.1) ffi (1.15.5) - figaro (1.1.1) - thor (~> 0.14) - font-awesome-sass (5.13.0) - sassc (>= 1.11) + font-awesome-sass (6.2.0) + sassc (~> 2.0) foreman (0.87.2) friendly_id (5.2.5) activerecord (>= 4.0.0) - fugit (1.3.9) - et-orbi (~> 1.1, >= 1.1.8) - raabro (~> 1.3) + fugit (1.7.1) + et-orbi (~> 1, >= 1.2.7) + raabro (~> 1.4) gems (1.2.0) globalid (1.1.0) activesupport (>= 5.0) google-api-client (0.53.0) google-apis-core (~> 0.1) google-apis-generator (~> 0.1) - google-apis-core (0.4.2) + google-apis-core (0.9.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -166,43 +182,42 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-discovery_v1 (0.8.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-generator (0.4.1) + google-apis-discovery_v1 (0.12.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-generator (0.11.1) activesupport (>= 5.0) gems (~> 1.2) - google-apis-core (>= 0.4, < 2.a) + google-apis-core (>= 0.9.1, < 2.a) google-apis-discovery_v1 (~> 0.5) thor (>= 0.20, < 2.a) - googleauth (1.1.3) + googleauth (1.3.0) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - groupdate (4.1.2) - activesupport (>= 4.2) + groupdate (6.2.0) + activesupport (>= 5.2) hashie (5.0.0) htmlentities (4.3.4) http-accept (1.7.0) - http-cookie (1.0.4) + http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) i18n (1.12.0) concurrent-ruby (~> 1.0) - inline_svg (1.7.2) + inline_svg (1.8.0) activesupport (>= 3.0) nokogiri (>= 1.6) - jaro_winkler (1.5.4) jbuilder (2.9.1) activesupport (>= 4.2.0) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.3.1) - jwt (2.3.0) + json (2.6.2) + jwt (2.5.0) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -217,39 +232,47 @@ GEM kaminari-core (1.2.1) launchy (2.5.0) addressable (~> 2.7) - letter_opener (1.7.0) - launchy (~> 2.2) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) + matrix (0.4.2) memoist (0.16.2) method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0901) + mime-types-data (3.2022.0105) mini_mime (1.1.2) - mini_portile2 (2.8.1) minitest (5.17.0) mono_logger (1.1.0) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.1.1) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) + net-imap (0.3.1) + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.1.3) + timeout + net-smtp (0.3.2) + net-protocol netrc (0.11.0) nio4r (2.5.8) - nokogiri (1.13.10) - mini_portile2 (~> 2.8.0) + nokogiri (1.14.3-arm64-darwin) + racc (~> 1.4) + nokogiri (1.14.3-x86_64-darwin) racc (~> 1.4) - oauth2 (1.4.9) + oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) + rack (>= 1.2, < 4) omniauth (2.1.0) hashie (>= 3.4.6) rack (>= 2.2.3) @@ -261,34 +284,36 @@ GEM oauth2 (~> 1.1) omniauth (~> 2.0) omniauth-oauth2 (~> 1.7.1) - omniauth-oauth2 (1.7.2) - oauth2 (~> 1.4) + omniauth-oauth2 (1.7.3) + oauth2 (>= 1.4, < 3) omniauth (>= 1.9, < 3) omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) omniauth (~> 2.0) orm_adapter (0.5.0) os (1.1.4) - parallel (1.19.2) - parser (2.7.2.0) + parallel (1.22.1) + parser (3.1.2.1) ast (~> 2.4.1) pg (1.1.4) - premailer (1.14.2) + premailer (1.18.0) addressable - css_parser (>= 1.6.0) + css_parser (>= 1.12.0) htmlentities (>= 4.0.0) premailer-rails (1.11.1) actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) - pry (0.13.1) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) + pry (>= 0.13, < 0.15) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (4.0.6) + psych (4.0.6) + stringio + public_suffix (5.0.0) puma (5.6.4) nio4r (~> 2.0) pusher (1.3.3) @@ -304,28 +329,27 @@ GEM rack (>= 1.2.0) rack-protection (3.0.4) rack - rack-proxy (0.6.5) + rack-proxy (0.7.4) rack rack-rewrite (1.5.1) rack-test (2.0.2) rack (>= 1.3) - rack-timeout (0.6.0) + rack-timeout (0.6.3) railroady (1.5.3) - rails (6.0.4.8) - actioncable (= 6.0.4.8) - actionmailbox (= 6.0.4.8) - actionmailer (= 6.0.4.8) - actionpack (= 6.0.4.8) - actiontext (= 6.0.4.8) - actionview (= 6.0.4.8) - activejob (= 6.0.4.8) - activemodel (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) - bundler (>= 1.3.0) - railties (= 6.0.4.8) - sprockets-rails (>= 2.0.0) + rails (7.0.4.3) + actioncable (= 7.0.4.3) + actionmailbox (= 7.0.4.3) + actionmailer (= 7.0.4.3) + actionpack (= 7.0.4.3) + actiontext (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activemodel (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) + bundler (>= 1.15.0) + railties (= 7.0.4.3) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -333,33 +357,35 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-erd (1.6.0) + rails-erd (1.7.2) activerecord (>= 4.2) activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) rails-html-sanitizer (1.4.4) loofah (~> 2.19, >= 2.19.1) - rails-i18n (6.0.0) + rails-i18n (7.0.6) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) + railties (>= 6.0.0, < 8) rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (6.0.4.8) - actionpack (= 6.0.4.8) - activesupport (= 6.0.4.8) + railties (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) - rainbow (3.0.0) - rake (12.3.3) - rb-fsevent (0.10.4) + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) + rake (13.0.6) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.3.1) + rdoc (6.4.0) + psych (>= 4.0.0) react_on_rails (12.0.1) addressable connection_pool @@ -367,19 +393,19 @@ GEM rails (>= 3.2) rainbow (~> 3.0) webpacker (>= 4.0) - recaptcha (5.6.0) + recaptcha (5.12.3) json - redis (4.5.1) - redis-namespace (1.8.0) - redis (>= 3.0.4) - regexp_parser (1.8.1) - representable (3.1.1) + redis (4.8.0) + redis-namespace (1.9.0) + redis (>= 4) + regexp_parser (2.6.0) + representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) resque (2.0.0) mono_logger (~> 1.0) multi_json (~> 1.0) @@ -401,56 +427,61 @@ GEM netrc (~> 0.8) retriable (3.1.2) rexml (3.2.5) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) rspec-collection_matchers (1.1.3) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.11.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.9.1) + rspec-mocks (3.11.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (4.0.1) + rspec-support (~> 3.11.0) + rspec-rails (4.0.2) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) - rspec-core (~> 3.9) - rspec-expectations (~> 3.9) - rspec-mocks (~> 3.9) - rspec-support (~> 3.9) - rspec-support (3.9.3) - rspec_junit_formatter (0.4.1) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.11.1) + rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.80.1) - jaro_winkler (~> 1.5.1) + rubocop (1.37.1) + json (~> 2.3) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) - rexml + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.6.1) - rubocop (>= 0.71.0) - rubocop-rails (2.5.2) - activesupport + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.23.0) + parser (>= 3.1.1.0) + rubocop-performance (1.15.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.17.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) - rubocop-rspec (1.41.0) - rubocop (>= 0.68.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.14.2) + rubocop (~> 1.33) ruby-graphviz (1.2.5) rexml - ruby-progressbar (1.10.1) + ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) rubyzip (1.3.0) - rufus-scheduler (3.6.0) + rufus-scheduler (3.8.2) fugit (~> 1.1, >= 1.1.6) sass (3.7.4) sass-listen (~> 4.0.0) @@ -471,28 +502,28 @@ GEM childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) - semantic_range (2.3.0) - sentry-raven (2.13.0) - faraday (>= 0.7.6, < 1.0) - shoulda-matchers (4.4.1) - activesupport (>= 4.2.0) - sidekiq (6.4.0) - connection_pool (>= 2.2.2) + semantic_range (3.0.0) + sentry-raven (3.1.2) + faraday (>= 1.0) + shoulda-matchers (5.3.0) + activesupport (>= 5.2.0) + sidekiq (6.5.7) + connection_pool (>= 2.2.5) rack (~> 2.0) - redis (>= 4.2.0) - sidekiq-cron (1.2.0) - fugit (~> 1.1) + redis (>= 4.5.0, < 5) + sidekiq-cron (1.8.0) + fugit (~> 1) sidekiq (>= 4.2.1) - sidekiq-failures (1.0.0) + sidekiq-failures (1.0.4) sidekiq (>= 4.0.0) sidekiq-middleware (0.3.0) sidekiq (>= 2.12.4) - signet (0.16.1) + signet (0.17.0) addressable (~> 2.8) - faraday (>= 0.17.5, < 3.0) + faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simplecov (0.16.1) + simplecov (0.17.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) @@ -502,7 +533,7 @@ GEM rack (~> 2.2, >= 2.2.4) rack-protection (= 3.0.4) tilt (~> 2.0) - spring (2.1.1) + spring (4.1.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -510,33 +541,34 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - ssrf_filter (1.0.7) - thor (0.20.3) - thread_safe (0.3.6) + ssrf_filter (1.1.1) + stringio (3.0.2) + thor (1.2.1) tilt (2.0.11) + timeout (0.3.0) trailblazer-option (0.1.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.11) - thread_safe (~> 0.1) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) uber (0.1.0) uglifier (4.1.20) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.8) - unicode-display_width (1.6.1) - uniform_notifier (1.13.0) + unf_ext (0.0.8.2) + unicode-display_width (2.3.0) + uniform_notifier (1.16.0) vegas (0.1.11) rack (>= 1.0.0) warden (1.2.9) rack (>= 2.0.9) - webdrivers (5.0.0) + webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) - webpacker (5.1.1) + webpacker (5.4.3) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -550,22 +582,24 @@ GEM zeitwerk (2.6.7) PLATFORMS - ruby + arm64-darwin-21 + arm64-darwin-22 + x86_64-darwin-20 DEPENDENCIES actionview activerecord-import - annotate (~> 2.7) + annotate (~> 3.2.0) bcrypt (= 3.1.13) better_errors (~> 2.5) bullet bundler-audit byebug - capybara (~> 3.24.0) + capybara (~> 3.37.0) carrierwave (~> 1.3.1) certified (= 1.0.0) chronic (= 0.10.2) - cloudinary (~> 1.21.0) + cloudinary (~> 1.25.0) database_cleaner devise (~> 4.8.1) devise-pwned_password @@ -573,17 +607,17 @@ DEPENDENCIES devise_uid dotenv-rails (~> 2.7.2) factory_bot_rails - figaro (= 1.1.1) font-awesome-sass foreman friendly_id (~> 5.2.5) google-api-client (~> 0.53.0) - groupdate (= 4.1.2) + groupdate (~> 6.1) inline_svg jbuilder (~> 2.9.1) jquery-rails (= 4.4.0) kaminari (= 1.2.1) letter_opener + net-smtp omniauth (~> 2.0) omniauth-facebook omniauth-google-oauth2 (~> 1.0.1) @@ -592,16 +626,16 @@ DEPENDENCIES premailer-rails pry-byebug pry-rails - puma + puma (= 5.6.4) pusher (= 1.3.3) rack-mini-profiler rack-rewrite rack-timeout railroady (= 1.5.3) - rails (~> 6.0.4.8) + rails (~> 7.0.4.3) rails-controller-testing rails-erd (~> 1.6) - rails-i18n (~> 6.0.0) + rails-i18n (~> 7.0.5) rails_12factor (= 0.0.3) react_on_rails (= 12.0.1) recaptcha @@ -612,7 +646,7 @@ DEPENDENCIES rspec-html-matchers (~> 0.9.0) rspec-rails (~> 4.0.0) rspec_junit_formatter - rubocop (~> 0.80.1) + rubocop rubocop-performance rubocop-rails rubocop-rspec @@ -621,20 +655,21 @@ DEPENDENCIES sdoc (= 1.0.0) selenium-webdriver (~> 4.1.0) sentry-raven - shoulda-matchers - sidekiq (= 6.4.0) + shoulda-matchers (~> 5.3.0) + sidekiq sidekiq-cron (~> 1.1) sidekiq-failures sidekiq-middleware - simplecov (= 0.16.1) + simplecov (~> 0.17.0) spring + sprockets-rails turbolinks (~> 5.2.0) uglifier (~> 4.1.20) webdrivers (>= 5.0.0) - webpacker (= 5.1.1) + webpacker RUBY VERSION - ruby 2.6.10p210 + ruby 3.1.4p223 BUNDLED WITH - 2.3.22 + 2.3.24 diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 25387030b1..84b9846860 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -30,7 +30,6 @@ */ @import "base/*"; -@import "font-awesome-sprockets"; @import "font-awesome"; /* Text */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5e992f32a3..e60aa3a4a7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base - include ActionView::Helpers::UrlHelper include ActionView::Helpers::DateHelper include ActionView::Helpers::TextHelper include PageRedirectConcern diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index dd9480804f..d793cb7325 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -26,7 +26,7 @@ def delete def remove_meeting_notification!(comment_id) CommentNotificationsService.remove( comment_id: comment_id, - model_name: 'meeting' + model_name: 'Meeting' ) end @@ -46,7 +46,7 @@ def handle_create(comment_params) end def handle_delete(comment) - if %w[moment strategy].include?(comment.commentable_type) + if %w[Moment Strategy].include?(comment.commentable_type) raise RuntimeError unless CommentViewersService.deletable?( comment, current_user ) @@ -55,7 +55,7 @@ def handle_delete(comment) comment_id: comment.id, model_name: comment.commentable_type ) - elsif comment.commentable_type == 'meeting' + elsif comment.commentable_type == 'Meeting' meeting = Meeting.find(comment.commentable_id) remove_meeting_notification(comment, meeting) end diff --git a/app/controllers/groups/memberships_controller.rb b/app/controllers/groups/memberships_controller.rb index b5a8f8c040..b3c53f0a51 100644 --- a/app/controllers/groups/memberships_controller.rb +++ b/app/controllers/groups/memberships_controller.rb @@ -13,7 +13,7 @@ def create flash[:notice] = t('groups.join.success') redirect_to_group - rescue NoMethodError + rescue flash[:alert] = t('groups.join.group_not_exists') redirect_to groups_path end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 785459bbdc..d743b10d31 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -10,7 +10,7 @@ def destroy @notification.destroy if @notification.present? respond_to do |format| - format.html { redirect_back(fallback_location: notifications_path) } + format.html { redirect_back_or_to notifications_path } format.json { head :no_content } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 62f38bc24d..5feb208ee1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module ApplicationHelper include ViewersHelper + include AssetsHelper def html_options { class: 'htmlOptions' } @@ -17,6 +18,34 @@ def sign_in_path? devise_page?(new_user_session_path, 'sessions', 'new') end + def page_title + t('app_name') + + if sign_in_path? + " | " + t('account.sign_in') + elsif join_path? + " | " + t('account.sign_up') + elsif forgot_password_path? + " | " + t('account.forgot_password') + elsif update_account_path? + " | " + t('account.singular') + elsif current_page?(root_path) + " | " + t('app_description') + elsif send_ally_invitation_path? + " | " + t('devise.invitations.new.header') + elsif ally_accept_invitation_path? + " | " + t('devise.invitations.edit.header') + elsif reset_password_path? + " | " + t('layouts.title.reset_password') + elsif new_user_confirmation_path? + " | " + t('devise.confirmations.resend_confirmation') + else + " | " + title_content + end + end + + def title_content + content_for(:title) || 'a community for mental health experiences' + end def join_path? path = new_user_registration_path devise_page?(path, 'registrations', 'create') || diff --git a/app/helpers/moments_helper.rb b/app/helpers/moments_helper.rb index abe3e165ca..255cda9f37 100644 --- a/app/helpers/moments_helper.rb +++ b/app/helpers/moments_helper.rb @@ -2,6 +2,7 @@ module MomentsHelper include ViewersHelper include VisibleHelper + include ActionView::Helpers::UrlHelper def moments_data_json { @@ -14,14 +15,14 @@ def moments_data_html return unless current_user # +1 day buffer to ensure we include today as well - end_date = Date.current + 1.day - start_date = end_date - 1.week + start_date = 1.week.ago.to_date + end_date = Date.tomorrow range = start_date..end_date @react_moments = current_user.moments - .group_by_period('day', - :created_at, - range: range) - .count + .where(updated_at: range) + .group_by_period(:day, + :created_at) + .count if current_user.moments.exists? end def moments_or_strategy_props(elements) diff --git a/app/models/comment.rb b/app/models/comment.rb index e7017b076b..1a0e4f7ffd 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -19,7 +19,7 @@ class Comment < ApplicationRecord belongs_to :commentable, polymorphic: true validates :comment, length: { minimum: 0, maximum: 1000 }, presence: true - validates :commentable_type, inclusion: %w[moment strategy meeting] + validates :commentable_type, inclusion: %w[Moment Strategy Meeting] validates :commentable_id, :comment_by, presence: true validates :visibility, inclusion: %w[all private] @@ -48,7 +48,7 @@ def create_from!(params) def comments_from(data) Comment.where( commentable_id: data.id, - commentable_type: data.class.name.downcase + commentable_type: data.class.name ) end end @@ -56,7 +56,7 @@ def comments_from(data) # Notify commentable_id user that they have a new comment def notify_of_creation!(creator) association = associated_record - return handle_meeting(association, creator) if commentable_type == 'meeting' + return handle_meeting(association, creator) if commentable_type == 'Meeting' return unless notify_of_creation?(association) send_notification!(creator, association, user_to_notify(association)) diff --git a/app/models/meeting_member.rb b/app/models/meeting_member.rb index 069c88dcf9..d71ca4cd0e 100644 --- a/app/models/meeting_member.rb +++ b/app/models/meeting_member.rb @@ -27,5 +27,5 @@ class MeetingMember < ApplicationRecord belongs_to :meeting, foreign_key: :meeting_id belongs_to :user, foreign_key: :user_id - belongs_to :group_member, foreign_key: :user_id + belongs_to :group_member, foreign_key: :user_id, optional: true end diff --git a/app/models/report.rb b/app/models/report.rb index 932345e72a..de8e60a050 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -15,7 +15,7 @@ class Report < ApplicationRecord belongs_to :reporter, class_name: 'User' belongs_to :reportee, class_name: 'User' - belongs_to :comment, class_name: 'Comment' + belongs_to :comment, class_name: 'Comment', optional: true validates :reportee_id, presence: true validates :reporter_id, presence: true validates :reasons, presence: true diff --git a/app/models/user.rb b/app/models/user.rb index 846c31ada2..cf252e6bf3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,7 +111,7 @@ class User < ApplicationRecord # rubocop:disable Layout/LineLength has_many :data_requests, class_name: 'Users::DataRequest', foreign_key: :user_id # rubocop:enable Layout/LineLength - belongs_to :invited_by, class_name: 'User' + belongs_to :invited_by, class_name: 'User', optional: true after_initialize :set_defaults, unless: :persisted? before_save :remove_leading_trailing_whitespace @@ -207,11 +207,13 @@ def generate_data_request data_request = data_requests .where(status_id: Users::DataRequest::STATUS[:enqueued]) .first_or_initialize - return data_request.request_id if data_request.request_id.present? - - data_request.request_id = SecureRandom.uuid - data_request.save! - return data_request.request_id + if data_request.request_id.present? + data_request.request_id + else + data_request.request_id = SecureRandom.uuid + data_request.save! + end + data_request.request_id end end diff --git a/app/services/comment_notifications_service.rb b/app/services/comment_notifications_service.rb index 80e7801e43..8e615d2c72 100644 --- a/app/services/comment_notifications_service.rb +++ b/app/services/comment_notifications_service.rb @@ -8,8 +8,8 @@ def initialize(comment_id:, model_name:) @model_name = model_name end - def self.remove(args = {}) - new(args).remove + def self.remove(**args) + new(**args).remove end def remove diff --git a/app/services/medium.rb b/app/services/medium.rb index ca2e984fd4..9d41e96898 100644 --- a/app/services/medium.rb +++ b/app/services/medium.rb @@ -16,7 +16,7 @@ def content_hash def content content = '' - open('https://medium.com/ifme?format=json') do |file| + URI.open('https://medium.com/ifme?format=json') do |file| file.each_line { |line| content += line } end content diff --git a/app/services/meeting_notifications_service.rb b/app/services/meeting_notifications_service.rb index 844d3337cd..d296736ccb 100644 --- a/app/services/meeting_notifications_service.rb +++ b/app/services/meeting_notifications_service.rb @@ -10,8 +10,8 @@ def initialize(current_user:, meeting:, type:, members:) @uniqueid = "#{type}_#{current_user.id}" end - def self.handle_members(args = {}) - new(args).handle_members + def self.handle_members(**args) + new(**args).handle_members end def handle_members diff --git a/app/views/groups/index.html.erb b/app/views/groups/index.html.erb index 78ca0cf5a9..07cdb682c7 100644 --- a/app/views/groups/index.html.erb +++ b/app/views/groups/index.html.erb @@ -41,9 +41,9 @@
<%= t('pages.faq.group_question') %>
- <%= raw t('pages.faq.group_answer', { + <%= raw t('pages.faq.group_answer', group: t('groups.singular') - }) %> + ) %> <% end %> diff --git a/app/views/layouts/_title.html.erb b/app/views/layouts/_title.html.erb deleted file mode 100644 index 6cbddb7943..0000000000 --- a/app/views/layouts/_title.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%= t('app_name') %> -<% if sign_in_path? %> - | <%= t('account.sign_in') %> -<% elsif join_path? %> - | <%= t('account.sign_up') %> -<% elsif forgot_password_path? %> - | <%= t('account.forgot_password') %> -<% elsif update_account_path? %> - | <%= t('account.singular') %> -<% elsif current_page?(root_path) %> - | <%= t('app_description') %> -<% elsif send_ally_invitation_path? %> - | <%= t('devise.invitations.new.header') %> -<% elsif ally_accept_invitation_path? %> - | <%= t('devise.invitations.edit.header') %> -<% elsif reset_password_path? %> - | <%= t('layouts.title.reset_password') %> -<% elsif new_user_confirmation_path? %> - | <%= t('devise.confirmations.resend_confirmation') %> -<% else %> - | <%= yield(:title) %> -<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3cb3f70de5..9ef6923d8c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - <%= render 'layouts/title' %> + <%= page_title %> diff --git a/app/views/pages/_contributor_blurb.html.erb b/app/views/pages/_contributor_blurb.html.erb index 25ab058e59..6dd4ab768d 100644 --- a/app/views/pages/_contributor_blurb.html.erb +++ b/app/views/pages/_contributor_blurb.html.erb @@ -4,9 +4,9 @@ component: 'Avatar', props: { src: ProfilePicture.normalize_url(contributor_blurb["image"]), - alt: t('pages.contribute.contributor_avatar_alt', { + alt: t('pages.contribute.contributor_avatar_alt', name: contributor_blurb['name'] - }) + ) } }, body: <<~HEREDOC diff --git a/app/views/pages/_not_signed_in.html.erb b/app/views/pages/_not_signed_in.html.erb index 1115d0b9e6..2684f50d0b 100644 --- a/app/views/pages/_not_signed_in.html.erb +++ b/app/views/pages/_not_signed_in.html.erb @@ -61,10 +61,10 @@ <%= t('pages.home.not_signed_in.main_message_two') %>
- <%= raw t('pages.home.not_signed_in.message_text_two', { + <%= raw t('pages.home.not_signed_in.message_text_two', help: link_to(t('pages.home.not_signed_in.help'), about_path), feedback: link_to(t('navigation.feedback'), 'http://goo.gl/forms/8EqoJDDiXY', target: 'blank') - }) %> + ) %>
<%= render partial: 'contributor_blurb', collection: @blurbs %>
diff --git a/app/views/pages/_signed_in_empty.html.erb b/app/views/pages/_signed_in_empty.html.erb index 1c536574b0..9d6426e452 100644 --- a/app/views/pages/_signed_in_empty.html.erb +++ b/app/views/pages/_signed_in_empty.html.erb @@ -10,11 +10,11 @@
<%= t('pages.home.signed_in_empty.main_message_two') %>
- <%= raw t('pages.home.signed_in_empty.cell_one', { + <%= raw t('pages.home.signed_in_empty.cell_one', profile: link_to(t('profile.index.title'), edit_user_registration_path), moods: link_to(t('moods.plural'), moods_path), allies: link_to(t('allies.index.title'), allies_path) - }) %> + ) %>
@@ -26,10 +26,10 @@
<%= t('pages.home.signed_in_empty.main_message_three') %>
- <%= raw t('pages.home.signed_in_empty.cell_two', { + <%= raw t('pages.home.signed_in_empty.cell_two', categories: link_to(t('categories.plural'), categories_path), moments: link_to(t('moments.plural'), moments_path) - }) %> + ) %>
@@ -41,18 +41,18 @@
<%= t('pages.home.signed_in_empty.main_message_four') %>
- <%= raw t('pages.home.signed_in_empty.cell_three', { + <%= raw t('pages.home.signed_in_empty.cell_three', strategize: link_to(t('pages.home.signed_in_empty.strategize'), strategies_path), medications: link_to(t('medications.index.title'), medications_path), group: link_to(t('groups.singular'), groups_path) - }) %> + ) %>
<%= t('pages.home.signed_in_empty.main_message_five') %>
- <%= raw t('pages.home.signed_in_empty.message_text_three', { + <%= raw t('pages.home.signed_in_empty.message_text_three', faq: link_to(t('navigation.faq'), faq_path), email_link: link_to(t('common.write_to_us'), "mailto:#{t('email')}") - }) %> + ) %>
diff --git a/app/views/pages/about.html.erb b/app/views/pages/about.html.erb index f3ded427cb..5e537d7eef 100644 --- a/app/views/pages/about.html.erb +++ b/app/views/pages/about.html.erb @@ -7,9 +7,9 @@
- <%= raw t('pages.about.main_message_one', { + <%= raw t('pages.about.main_message_one', app_name: t('app_name') - }) %> + ) %>

<%= t('pages.about.message_text_one') %>

@@ -32,17 +32,17 @@
- <%= raw t('pages.contribute.message_text_one', { + <%= raw t('pages.contribute.message_text_one', email_link: link_to(t('common.write_to_us'), "https://github.com/ifmeorg/ifme/wiki/Join-Our-Slack"), slack_link: link_to(t('pages.contribute.slack'), 'https://ifme.slack.com', target: 'blank'), github_link: link_to(t('navigation.github'), 'https://github.com/ifmeorg/ifme', target: 'blank') - }) + ) %>

- <%= raw t('pages.about.message_text_three', { + <%= raw t('pages.about.message_text_three', fund_club_link: link_to(t('pages.about.fund_club'), 'http://joinfundclub.com', target: 'blank'), open_collective_link: link_to(t('navigation.open_collective'), 'https://opencollective.com/ifme', target: 'blank') - }) %> + ) %>

diff --git a/app/views/pages/faq.html.erb b/app/views/pages/faq.html.erb index a295684674..f319592fc6 100644 --- a/app/views/pages/faq.html.erb +++ b/app/views/pages/faq.html.erb @@ -14,10 +14,10 @@ <%= t('pages.faq.moment_question') %>

- <%= raw t('pages.faq.moment_answer', { + <%= raw t('pages.faq.moment_answer', moment: link_to(t('moments.singular'), moments_path), moment_templates: link_to(t('moment_templates.index.title'), moment_templates_path) - }) %> + ) %>

@@ -87,8 +87,8 @@

<%= t('pages.faq.email_notifications_question') %>

- <%= raw t('pages.faq.email_notifications_answer', { + <%= raw t('pages.faq.email_notifications_answer', accounts: link_to(t('account.singular'), edit_user_registration_path ) - }) %> + ) %>

diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 33d3d974f6..c76692675e 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -3,7 +3,7 @@ <% @page_new = "New Moment" %> <% page_new new_moment_path %> <% elsif user_signed_in? %> - <% title t('pages.home.signed_in_empty.main_message_one', { name: current_user.name }) %> + <% title t('pages.home.signed_in_empty.main_message_one', name: current_user.name) %> <% end %> <% if !user_signed_in? %> diff --git a/app/views/pages/partners.html.erb b/app/views/pages/partners.html.erb index b429e1f96c..cf93cbf8cb 100644 --- a/app/views/pages/partners.html.erb +++ b/app/views/pages/partners.html.erb @@ -1,7 +1,7 @@ <% title t('navigation.partners') %>
- <%= raw t('pages.partners.description', { + <%= raw t('pages.partners.description', email: link_to(t('email'), "mailto:#{t('email')}") - }) %> + ) %>
<%= print_partners(@organizations) %> diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index 0d190582cb..dc19850a4d 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -13,9 +13,9 @@

<%= raw t('pages.faq.data_access_answer') %>

- <%= raw t('pages.privacy.user_data_description', { + <%= raw t('pages.privacy.user_data_description', faq_link: link_to(t('pages.faq.title'), faq_path) - }) %> + ) %> @@ -36,8 +36,8 @@

<%= t('pages.privacy.contact') %>

- <%= raw t('pages.privacy.contact_description', { + <%= raw t('pages.privacy.contact_description', email_link: link_to(t('common.write_to_us'), "mailto:#{t('email')}") - }) %> + ) %>
diff --git a/app/views/shared/_comments.html.erb b/app/views/shared/_comments.html.erb index 60740a5fed..c0df616273 100644 --- a/app/views/shared/_comments.html.erb +++ b/app/views/shared/_comments.html.erb @@ -2,6 +2,6 @@ comments: @comments, formProps: comment_form_props( local_assigns[:commentable], - local_assigns[:commentable].class.name.downcase + local_assigns[:commentable].class.name ) }) %> diff --git a/bin/rails b/bin/rails index 0739660237..efc0377492 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 17240489f6..4fbf10b960 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index d9b4d2bce6..ec47b79b3b 100755 --- a/bin/setup +++ b/bin/setup @@ -1,34 +1,33 @@ #!/usr/bin/env ruby -require 'pathname' -require 'fileutils' +require "fileutils" # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end FileUtils.chdir APP_ROOT do - # This script is a way to setup or update your development environment automatically. - # This script is idempotent, so that you can run it at anytime and get an expectable outcome. + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config/application.rb b/config/application.rb index 92401e968e..fbfdf27036 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative 'boot' -require_relative 'locale' -require 'rails/all' +require_relative "boot" +require_relative "locale" +require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -11,23 +11,15 @@ module Ifme class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration can go into files in config/initializers - # -- all .rb files in that directory are automatically loaded after loading - # the framework and any gems in your application. - # Set Time.zone default to the specified zone and make Active Record - # auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - # Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from - # config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[ - # Rails.root.join('my', 'locales', '*.{rb,yml}').to_s - # ] + config.load_defaults 7.0 + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") config.exceptions_app = routes diff --git a/config/boot.rb b/config/boot.rb index 488e1c0955..de9693cf0d 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require "bundler/setup" # Set up gems listed in the Gemfile. -if Gem::Specification.find_all_by_name('dotenv').any? - require 'dotenv' - environment = ENV['RAILS_ENV'] || :development - dotenv_path = File.join('config', 'env', "#{environment}.env") +if Gem::Specification.find_all_by_name("dotenv").any? + require "dotenv" + environment = ENV["RAILS_ENV"] || :development + dotenv_path = File.join("config", "env", "#{environment}.env") Dotenv.load(dotenv_path) end diff --git a/config/database.yml b/config/database.yml index 6a6265cce1..f2d3d18a15 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,22 +1,21 @@ -development: &default +default: &default adapter: postgresql + allow_concurrency: true encoding: unicode + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> +development: + <<: *default host: <%= ENV['PSQL_HOST'] || 'localhost' %> database: ifme_development username: <%= ENV['PSQL_USERNAME'] %> password: <%= ENV['PSQL_PASSWORD'] %> - allow_concurrency: true - pool: 5 min_messages: warning test: <<: *default database: ifme_test min_messages: error production: - adapter: postgresql - encoding: unicode + <<: *default database: ifme_production username: <%= ENV['PSQL_USERNAME'] %> password: <%= ENV['PSQL_PASSWORD'] %> - allow_concurrency: true - pool: 5 diff --git a/config/environment.rb b/config/environment.rb index d5abe55806..7df99e89c6 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Load the Rails application. -require_relative 'application' +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index a7c4e64b82..f47957d395 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" primary_domain = 'localhost:3000' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -16,16 +17,19 @@ # reroute all requests with errors to the views/layouts/errors.html.erb page config.consider_all_requests_local = false + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? - config.action_controller.perform_caching = false + if Rails.root.join("tmp", "caching-dev.txt").exist? + config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=172800' + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -33,9 +37,18 @@ config.cache_store = :null_store end + # Store uploaded files on the local file system (see config/storage.yml for options). + config.active_storage.service = :local + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load @@ -48,14 +61,11 @@ config.assets.debug = true # Suppress logger output for asset requests. - # Suppress writing of asset requests to the log file config.assets.quiet = true # Raises error for missing translations. - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -63,9 +73,13 @@ config.action_mailer.default_url_options = { host: primary_domain } config.action_mailer.perform_deliveries = ENV['SEND_EMAIL'] config.action_mailer.raise_delivery_errors = ENV['RAISE_DELIVERY_ERRORS'] + config.action_view.annotate_rendered_view_with_filenames = true # To preview email in browser rather than to send a mail to actual user during development config.action_mailer.delivery_method = :letter_opener + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true # If you want to actually test emails, you will have to configure SMTP settings in smtp.yml config.action_mailer.smtp_settings = { diff --git a/config/environments/production.rb b/config/environments/production.rb index 9394bd426d..ebce60fbeb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" primary_domain = 'www.if-me.org' Rails.application.configure do @@ -24,17 +25,15 @@ # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - # config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScript and CSS using a preprocessor. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Generate digests for assets URLs. config.assets.digest = true @@ -44,7 +43,7 @@ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). - # config.active_storage.service = :local + config.active_storage.service = :local # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil @@ -66,7 +65,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "ifme_#{Rails.env}" + # config.active_job.queue_name_prefix = "ifme_production" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -78,7 +77,7 @@ config.i18n.fallbacks = true # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new diff --git a/config/environments/test.rb b/config/environments/test.rb index 381ab7fb7f..c2495aa54a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -8,18 +10,18 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.action_view.cache_template_loading = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=3600' + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. @@ -28,7 +30,7 @@ config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = true + config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -48,6 +50,15 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raises error for missing translations. - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 16dfce4516..9ab91c905d 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,7 +3,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 41c43016f1..54f47cf15f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,28 +1,25 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 7a4f47b4c2..adc6568ce8 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index dc84742212..3860f659ea 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,18 +1,16 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 0000000000..4d580245a5 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -0,0 +1,135 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +# `button_to` view helper will render `