From 92f8a843691a65cb3235cb6fdb08881660e6ceb9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 1 Aug 2020 20:16:33 +1200 Subject: [PATCH 01/72] Remove figaro gem and use rails-dotenv --- Gemfile | 3 +- Gemfile.lock | 8 +-- config/application.yml.example => env-example | 54 +++++++------------ 3 files changed, 25 insertions(+), 40 deletions(-) rename config/application.yml.example => env-example (58%) diff --git a/Gemfile b/Gemfile index ea30dda3f..325a228f5 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,6 @@ gem 'js-routes' # provides access to Rails routes in Javascript gem 'cancancan' # for checking member privileges gem 'csv_shaper' # CSV export -gem 'figaro' # for handling config via ENV variables gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions # Maps @@ -163,6 +162,8 @@ group :development, :test do gem 'rubocop-rspec' gem 'webrat' # provides HTML matchers for view tests + gem 'dotenv-rails' + # cli utils gem 'coveralls', require: false # coverage analysis gem 'haml-i18n-extractor', require: false diff --git a/Gemfile.lock b/Gemfile.lock index b7f896cb1..5998f06f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,6 +163,10 @@ GEM discard (1.2.0) activerecord (>= 4.2, < 7) docile (1.1.5) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) elasticsearch (6.8.2) elasticsearch-api (= 6.8.2) elasticsearch-transport (= 6.8.2) @@ -193,8 +197,6 @@ GEM faraday_middleware (1.0.0) faraday (~> 1.0) ffi (1.13.0) - figaro (1.2.0) - thor (>= 0.14.0, < 2) flickraw (0.9.10) font-awesome-sass (5.13.0) sassc (>= 1.11) @@ -613,12 +615,12 @@ DEPENDENCIES database_cleaner devise discard (~> 1.0) + dotenv-rails elasticsearch (< 7.0.0) factory_bot_rails faker faraday faraday_middleware - figaro flickraw font-awesome-sass friendly_id diff --git a/config/application.yml.example b/env-example similarity index 58% rename from config/application.yml.example rename to env-example index fdd60d407..1a046716c 100644 --- a/config/application.yml.example +++ b/env-example @@ -15,7 +15,7 @@ # Settings in this file will be available to you as ENV['WHATEVER'] -# NOTE: please prefix all environment variables with GROWSTUFF_ to make +# NOTE=please prefix all environment variables with GROWSTUFF_ to make # it easy to identify which were set by us vs. the system or anyone else ############################################################################## @@ -26,10 +26,10 @@ # It's the only one without "GROWSTUFF_" prefix. # To generate a real one, use 'rake secret' (you don't need to for # dev, though.) -RAILS_SECRET_TOKEN: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +RAILS_SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # name that appears on the site, eg. in page titles -GROWSTUFF_SITE_NAME: Growstuff (dev) +GROWSTUFF_SITE_NAME="Growstuff (dev)" # Mailchimp is used for subscribing/unsubscribing people from the newsletter # To fetch list IDs using Gibbon (and thus find the ID of your newsletter): @@ -37,45 +37,27 @@ GROWSTUFF_SITE_NAME: Growstuff (dev) # Gibbon::API.api_key = '...' # gb = Gibbon::API.new # puts gb.lists.list.to_yaml -GROWSTUFF_MAILCHIMP_APIKEY: "" -GROWSTUFF_MAILCHIMP_NEWSLETTER_ID: "" +GROWSTUFF_MAILCHIMP_APIKEY="" +GROWSTUFF_MAILCHIMP_NEWSLETTER_ID="" # Used for connecting member accounts to Twitter # Get Twitter key from https://dev.twitter.com/apps -GROWSTUFF_TWITTER_KEY: "" -GROWSTUFF_TWITTER_SECRET: "" +GROWSTUFF_TWITTER_KEY="" +GROWSTUFF_TWITTER_SECRET="" # Used for connecting member accounts to Flickr # Get Flickr key from http://www.flickr.com/services/apps/create/apply/ -GROWSTUFF_FLICKR_KEY: "" -GROWSTUFF_FLICKR_SECRET: "" +GROWSTUFF_FLICKR_KEY="" +GROWSTUFF_FLICKR_SECRET="" # https://developers.facebook.com/ -GROWSTUFF_FACEBOOK_KEY: "" -GROWSTUFF_FACEBOOK_SECRET: "" +GROWSTUFF_FACEBOOK_KEY="" +GROWSTUFF_FACEBOOK_SECRET="" -GROWSTUFF_MAPBOX_MAP_ID: "" -GROWSTUFF_MAPBOX_ACCESS_TOKEN: "" - -############################################################################## -# Other environments -# You can override the above for staging, production, etc. -# To push these settings to Heroku, use "rake figaro:heroku --app=whatever". -# To see current settings on Heroku, use "heroku config --app=whatever". -############################################################################## - -### EMAil addres for notifier and mailers to use as from -GROWSTUFF_EMAIL: 'noreply@dev.growstuff.org' - -test: - GROWSTUFF_SITE_NAME: Growstuff (test) - -# Note: there is no good way to deploy settings from Figaro to -# Travis-CI. If you need env vars set there in order for tests to pass, -# set them in .travis.yml - -staging: - GROWSTUFF_SITE_NAME: Growstuff (staging) - -production: - GROWSTUFF_SITE_NAME: Growstuff +# Elasticsearch is used for flexible search and it requires another component +# to be installed. To make it easy for people who don't need to test this feature +# it's been turned off for test and development environment as a default. +# If you want to test this functionality, install elasticsearch and +# set this flag to "true". +GROWSTUFF_ELASTICSEARCH="true" +GROWSTUFF_EMAIL='noreply@dev.growstuff.org' From 3596ef1a10eeef5620400fe5fcc235289c18b9be Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:20:52 +1200 Subject: [PATCH 02/72] Ignore the .env file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 96147c719..46fc54a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .byebug_history .bundle +.env # Folders to ignore /log From 7c8a0c98427dd1ab81c3955d2a089f0d6c9813c8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2020 22:33:54 +0000 Subject: [PATCH 03/72] [Security] Bump kramdown from 2.2.1 to 2.3.0 Bumps [kramdown](https://github.com/gettalong/kramdown) from 2.2.1 to 2.3.0. **This update includes a security fix.** - [Release notes](https://github.com/gettalong/kramdown/releases) - [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page) - [Commits](https://github.com/gettalong/kramdown/commits) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5998f06f9..d4b18f717 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -281,7 +281,7 @@ GEM jsonapi-swagger (0.8.0) jwt (2.2.1) kgio (2.11.3) - kramdown (2.2.1) + kramdown (2.3.0) rexml launchy (2.5.0) addressable (~> 2.7) From 8c1a2356a6c67cf0b4314ce08dea363572f5ce7b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2020 12:31:47 +0000 Subject: [PATCH 04/72] Bump chartkick from 3.3.2 to 3.4.0 Bumps [chartkick](https://github.com/ankane/chartkick) from 3.3.2 to 3.4.0. - [Release notes](https://github.com/ankane/chartkick/releases) - [Changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md) - [Commits](https://github.com/ankane/chartkick/compare/v3.3.2...v3.4.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d4b18f717..ed60a1dd6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -112,7 +112,7 @@ GEM image_processing (~> 1.1) mimemagic (>= 0.3.0) mini_mime (>= 0.1.3) - chartkick (3.3.2) + chartkick (3.4.0) childprocess (3.0.0) codeclimate-test-reporter (1.0.9) simplecov (<= 0.13) From 9d1feef226cf61abc860e64f0b5ffd665314bf26 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 1 Aug 2020 20:33:51 +1200 Subject: [PATCH 05/72] Upgrade rails gem to 6 --- Gemfile | 2 +- Gemfile.lock | 154 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 93 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 325a228f5..6f379f9c0 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' ruby '2.6.5' -gem 'rails', '5.2.4.3' +gem 'rails', '6.0.3.2' # Keeping old sprockets # https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050 diff --git a/Gemfile.lock b/Gemfile.lock index ed60a1dd6..9c331732a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,29 +3,42 @@ GEM remote: https://rails-assets.org/ specs: abstract_type (0.0.7) - actioncable (5.2.4.3) - actionpack (= 5.2.4.3) + actioncable (6.0.3.2) + actionpack (= 6.0.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) + actionmailbox (6.0.3.2) + actionpack (= 6.0.3.2) + activejob (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) + mail (>= 2.7.1) + actionmailer (6.0.3.2) + actionpack (= 6.0.3.2) + actionview (= 6.0.3.2) + activejob (= 6.0.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.3) - actionview (= 5.2.4.3) - activesupport (= 5.2.4.3) + actionpack (6.0.3.2) + actionview (= 6.0.3.2) + activesupport (= 6.0.3.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.3) - activesupport (= 5.2.4.3) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.3.2) + actionpack (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) + nokogiri (>= 1.8.5) + actionview (6.0.3.2) + activesupport (= 6.0.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) + rails-html-sanitizer (~> 1.1, >= 1.2.0) active_link_to (1.0.5) actionpack addressable @@ -36,24 +49,25 @@ GEM active_utils (3.3.17) activesupport (>= 4.2) i18n - activejob (5.2.4.3) - activesupport (= 5.2.4.3) + activejob (6.0.3.2) + activesupport (= 6.0.3.2) globalid (>= 0.3.6) - activemodel (5.2.4.3) - activesupport (= 5.2.4.3) - activerecord (5.2.4.3) - activemodel (= 5.2.4.3) - activesupport (= 5.2.4.3) - arel (>= 9.0) - activestorage (5.2.4.3) - actionpack (= 5.2.4.3) - activerecord (= 5.2.4.3) + activemodel (6.0.3.2) + activesupport (= 6.0.3.2) + activerecord (6.0.3.2) + activemodel (= 6.0.3.2) + activesupport (= 6.0.3.2) + activestorage (6.0.3.2) + actionpack (= 6.0.3.2) + activejob (= 6.0.3.2) + activerecord (= 6.0.3.2) marcel (~> 0.3.1) - activesupport (5.2.4.3) + activesupport (6.0.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) adamantium (0.2.0) ice_nine (~> 0.11.0) memoizable (~> 0.4.0) @@ -63,11 +77,10 @@ GEM abstract_type (~> 0.0.7) adamantium (~> 0.2) equalizer (~> 0.0.11) - arel (9.0.0) ast (2.4.1) - autoprefixer-rails (9.7.6) + autoprefixer-rails (9.8.6.1) execjs - bcrypt (3.1.13) + bcrypt (3.1.15) better_errors (2.7.1) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -142,12 +155,12 @@ GEM equalizer (~> 0.0.9) concurrent-ruby (1.1.6) connection_pool (2.2.3) - coveralls (0.8.19) - json (>= 1.8, < 3) - simplecov (~> 0.12.0) - term-ansicolor (~> 1.3) - thor (~> 0.19.1) - tins (~> 1.6) + coveralls (0.7.1) + multi_json (~> 1.3) + rest-client + simplecov (>= 0.7) + term-ansicolor + thor crass (1.0.6) csv_shaper (1.3.1) activesupport (>= 3.0.0) @@ -159,10 +172,12 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.3) + diff-lcs (1.4.4) discard (1.2.0) activerecord (>= 4.2, < 7) docile (1.1.5) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) @@ -183,7 +198,7 @@ GEM equalizer (0.0.11) erubi (1.9.0) erubis (2.7.0) - excon (0.73.0) + excon (0.76.0) execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -196,7 +211,7 @@ GEM multipart-post (>= 1.2, < 3) faraday_middleware (1.0.0) faraday (~> 1.0) - ffi (1.13.0) + ffi (1.13.1) flickraw (0.9.10) font-awesome-sass (5.13.0) sassc (>= 1.11) @@ -243,7 +258,10 @@ GEM haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - httparty (0.18.0) + http-accept (1.7.0) + http-cookie (1.0.3) + domain_name (~> 0.5) + httparty (0.18.1) mime-types (~> 3.0) multi_xml (>= 0.5.2) i18n (1.8.5) @@ -271,7 +289,7 @@ GEM js-routes (1.4.9) railties (>= 4) sprockets-rails - json (2.3.0) + json (2.3.1) json-schema (2.8.1) addressable (>= 2.4) jsonapi-resources (0.10.2) @@ -320,9 +338,10 @@ GEM mini_portile2 (2.4.0) minitest (5.14.1) moneta (1.0.0) - multi_json (1.14.1) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) + netrc (0.11.0) nio4r (2.5.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) @@ -374,18 +393,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.3) - actioncable (= 5.2.4.3) - actionmailer (= 5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) - activemodel (= 5.2.4.3) - activerecord (= 5.2.4.3) - activestorage (= 5.2.4.3) - activesupport (= 5.2.4.3) + rails (6.0.3.2) + actioncable (= 6.0.3.2) + actionmailbox (= 6.0.3.2) + actionmailer (= 6.0.3.2) + actionpack (= 6.0.3.2) + actiontext (= 6.0.3.2) + actionview (= 6.0.3.2) + activejob (= 6.0.3.2) + activemodel (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) bundler (>= 1.3.0) - railties (= 5.2.4.3) + railties (= 6.0.3.2) sprockets-rails (>= 2.0.0) rails-assets-leaflet (1.5.1) rails-assets-leaflet.markercluster (1.4.1) @@ -399,20 +420,20 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails-i18n (5.1.3) + rails-i18n (6.0.0) i18n (>= 0.7, < 2) - railties (>= 5.0, < 6) + railties (>= 6.0.0, < 7) 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 (5.2.4.3) - actionpack (= 5.2.4.3) - activesupport (= 5.2.4.3) + railties (6.0.3.2) + actionpack (= 6.0.3.2) + activesupport (= 6.0.3.2) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) raindrops (0.19.1) rake (13.0.1) @@ -425,6 +446,11 @@ GEM responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) rexml (3.2.4) rspec (3.9.0) rspec-core (~> 3.9.0) @@ -514,12 +540,12 @@ GEM selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - sexp_processor (4.14.1) + sexp_processor (4.15.0) sidekiq (6.1.1) connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) - simplecov (0.12.0) + simplecov (0.13.0) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) @@ -538,7 +564,7 @@ GEM tins (~> 1.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - thor (0.19.4) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) timecop (0.9.1) @@ -549,6 +575,9 @@ GEM thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) unicode-display_width (1.7.0) unicorn (5.6.0) kgio (~> 2.6) @@ -575,7 +604,7 @@ GEM nokogiri (>= 1.2.0) rack (>= 1.0) rack-test (>= 0.5.3) - websocket-driver (0.7.2) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) will_paginate (3.3.0) @@ -584,6 +613,7 @@ GEM xmlrpc (0.3.0) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.4.0) PLATFORMS ruby @@ -658,7 +688,7 @@ DEPENDENCIES query_diet rack-cors rack-protection (>= 2.0.1) - rails (= 5.2.4.3) + rails (= 6.0.3.2) rails-assets-leaflet.markercluster! rails-controller-testing rails_12factor From 59efe926486e4c5a855501808cf7c9305b235ba6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:12:38 +1200 Subject: [PATCH 06/72] Upgrade to rails 6 --- bin/setup | 14 +++--- bin/yarn | 14 +++--- .../initializers/content_security_policy.rb | 5 +++ .../new_framework_defaults_6_0.rb | 45 +++++++++++++++++++ config/puma.rb | 29 +++++------- ..._attachments_for_blob_id.active_storage.rb | 10 +++++ db/schema.rb | 12 ++--- 7 files changed, 90 insertions(+), 39 deletions(-) create mode 100644 config/initializers/new_framework_defaults_6_0.rb create mode 100644 db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb diff --git a/bin/setup b/bin/setup index c2e43ceb2..5853b5ea8 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,5 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -11,24 +8,25 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +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. # Add necessary setup steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' diff --git a/bin/yarn b/bin/yarn index 268a9398f..460dd565b 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,11 +1,11 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - exec "yarnpkg", *ARGV -rescue Errno::ENOENT - warn "Yarn executable was not detected in the system." - warn "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 497f5667c..f3bcce546 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -12,6 +12,8 @@ # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" @@ -20,6 +22,9 @@ # 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 diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb new file mode 100644 index 000000000..92240ef5f --- /dev/null +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -0,0 +1,45 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 6.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Don't force requests from old versions of IE to be UTF-8 encoded. +# Rails.application.config.action_view.default_enforce_utf8 = false + +# Embed purpose and expiry metadata inside signed and encrypted +# cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.0. +# Rails.application.config.action_dispatch.use_cookies_with_metadata = true + +# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. +# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false + +# Return false instead of self when enqueuing is aborted from a callback. +# Rails.application.config.active_job.return_false_on_aborted_enqueue = true + +# Send Active Storage analysis and purge jobs to dedicated queues. +# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis +# Rails.application.config.active_storage.queues.purge = :active_storage_purge + +# When assigning to a collection of attachments declared via `has_many_attached`, replace existing +# attachments instead of appending. Use #attach to add new attachments without replacing existing ones. +# Rails.application.config.active_storage.replace_on_assign_to_many = true + +# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. +# +# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), +# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. +# If you send mail in the background, job workers need to have a copy of +# MailDeliveryJob to ensure all delivery jobs are processed properly. +# Make sure your entire app is migrated and stable on 6.0 before using this setting. +# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" + +# Enable the same cache key to be reused when the object being cached of type +# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) +# of the relation's cache key into the cache version to support recycling cache key. +# Rails.application.config.active_record.collection_cache_versioning = true diff --git a/config/puma.rb b/config/puma.rb index bcf8670ad..5ed443774 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,45 +1,38 @@ -# frozen_string_literal: true - -# Overview of config: -# https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server - # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } -threads threads_count, threads_count +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # -port ENV.fetch('PORT') { 3000 } +port ENV.fetch("PORT") { 3000 } # Specifies the `environment` that Puma will run in. # -environment ENV.fetch('RAILS_ENV') { 'development' } +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } # Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together +# Workers are forked web server processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). # -workers ENV.fetch('WEB_CONCURRENCY') { 2 } +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write # process behavior so workers use less memory. # -preload_app! - -on_worker_boot do - # Worker specific setup for Rails 4.1+ - # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot - ActiveRecord::Base.establish_connection -end +# preload_app! # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb new file mode 100644 index 000000000..ff5d72c7e --- /dev/null +++ b/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb @@ -0,0 +1,10 @@ +# This migration comes from active_storage (originally 20180723000244) +class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] + def up + return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) + + if table_exists?(:active_storage_blobs) + add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index ed75b6452..f41c856d3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,15 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `rails +# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_12_26_051019) do +ActiveRecord::Schema.define(version: 2020_08_01_084007) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" From 9dbf8b7c8f0d4321100cef4afe373a834bf77959 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:18:44 +1200 Subject: [PATCH 07/72] New robocops --- app/controllers/conversations_controller.rb | 7 +++--- app/helpers/application_helper.rb | 19 +++++++-------- app/models/crop.rb | 2 +- app/models/garden.rb | 5 ++-- app/models/post.rb | 6 ++--- config/environments/test.rb | 4 ++-- config/initializers/devise.rb | 1 - db/migrate/20191119030244_cms_tags.rb | 24 +++++++++---------- ..._attachments_for_blob_id.active_storage.rb | 4 +--- spec/models/ability_spec.rb | 2 +- spec/models/photo_spec.rb | 4 ++-- 11 files changed, 37 insertions(+), 41 deletions(-) diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index 2f794aaf2..4d80aba68 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -7,9 +7,10 @@ class ConversationsController < ApplicationController before_action :check_current_subject_in_conversation, only: %i(show update destroy) def index - @conversations = if @box.eql? "inbox" + @conversations = case @box + when "inbox" mailbox.inbox - elsif @box.eql? "sent" + when "sent" mailbox.sentbox else mailbox.trash @@ -59,7 +60,7 @@ class ConversationsController < ApplicationController 'sent' => { 'total' => mailbox.sentbox.size, 'unread' => 0 }, 'trash' => { 'total' => mailbox.trash.size, 'unread' => 0 } } - @box = if params[:box].blank? || !@boxes.keys.include?(params[:box]) + @box = if params[:box].blank? || @boxes.keys.exclude?(params[:box]) 'inbox' else params[:box] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d47919429..aae956656 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -29,9 +29,9 @@ module ApplicationHelper end def required_field_help_text - asterisk = content_tag :span, '*', class: ['red'] - text = content_tag :em, 'denotes a required field' - content_tag :div, asterisk + ' '.html_safe + text, class: ['margin-bottom'] + asterisk = tag.span('*', class: ['red']) + text = tag.em('denotes a required field') + tag.div(asterisk + ' '.html_safe + text, class: ['margin-bottom']) end # @@ -69,14 +69,13 @@ module ApplicationHelper def show_inactive_tickbox_path(type, owner: nil, crop: nil, show_all: false) all = show_all ? '' : 1 - path = if owner.present? - public_send("member_#{type}_path", owner, all: all) - elsif crop.present? - public_send("crop_#{type}_path", crop, all: all) - else - public_send("#{type}_path", all: all) + if owner.present? + public_send("member_#{type}_path", owner, all: all) + elsif crop.present? + public_send("crop_#{type}_path", crop, all: all) + else + public_send("#{type}_path", all: all) end - path end def title(type, owner, crop, planting) diff --git a/app/models/crop.rb b/app/models/crop.rb index c5de8aa2c..b47999fb5 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -50,7 +50,7 @@ class Crop < ApplicationRecord ## Wikipedia urls are only necessary when approving a crop validates :en_wikipedia_url, format: { - with: %r{\Ahttps?:\/\/en\.wikipedia\.org\/wiki\/[[:alnum:]%_\.()-]+\z}, + with: %r{\Ahttps?://en\.wikipedia\.org/wiki/[[:alnum:]%_.()-]+\z}, message: 'is not a valid English Wikipedia URL' }, if: :approved? diff --git a/app/models/garden.rb b/app/models/garden.rb index bbf2e7c72..b0be0f03c 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -14,6 +14,8 @@ class Garden < ApplicationRecord # set up geocoding geocoded_by :location + before_validation :strip_blanks + after_validation :cleanup_area after_validation :geocode after_validation :empty_unwanted_geocodes after_save :mark_inactive_garden_plantings_as_finished @@ -25,7 +27,6 @@ class Garden < ApplicationRecord validates :location, length: { maximum: 255 } validates :slug, uniqueness: true - before_validation :strip_blanks validates :name, uniqueness: { scope: :owner_id } validates :name, format: { without: /\n/, message: "must contain no newlines" }, @@ -51,8 +52,6 @@ class Garden < ApplicationRecord message: "%s is not a valid area unit" }, allow_blank: true - after_validation :cleanup_area - def cleanup_area self.area = nil if area&.zero? self.area_unit = nil if area.blank? diff --git a/app/models/post.rb b/app/models/post.rb index e5a84c82e..3a1dc548c 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -68,7 +68,7 @@ class Post < ApplicationRecord crop_name = Regexp.last_match(1) crop = Crop.case_insensitive_name(crop_name).first # create association - crops << crop if crop && !crops.include?(crop) + crops << crop if crop && crops.exclude?(crop) end end @@ -78,12 +78,12 @@ class Post < ApplicationRecord body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |_m| # find member case-insensitively and add to list of recipients member = Member.case_insensitive_login_name(Regexp.last_match(1)).first - recipients << member if member && !recipients.include?(member) + recipients << member if member && recipients.exclude?(member) end body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |_m| # find member case-insensitively and add to list of recipients member = Member.case_insensitive_login_name(Regexp.last_match(1)[1..-1]).first - recipients << member if member && !recipients.include?(member) + recipients << member if member && recipients.exclude?(member) end # don't send notifications to yourself recipients.map(&:id).each do |recipient_id| diff --git a/config/environments/test.rb b/config/environments/test.rb index f875cc078..1cfd2c15a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -61,7 +61,7 @@ Geocoder.configure(lookup: :test) Geocoder::Lookup::Test.add_stub( "Amundsen-Scott Base, Antarctica", [ { - 'coordinates' => [-90.0, 0.0] + 'coordinates' => [-90.0, 0.0] } ] ) @@ -69,7 +69,7 @@ Geocoder::Lookup::Test.add_stub( Geocoder::Lookup::Test.add_stub( "Philippines", [ { - 'coordinates' => [12.7503486, 122.7312101], + 'coordinates' => [12.7503486, 122.7312101], 'address' => 'Manila, Mnl, Philippines', 'state' => 'Manila', 'state_code' => 'Mnl', diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 66c3995ae..3773df6c8 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -237,4 +237,3 @@ Devise.setup do |config| # Later we may wish to ask for user_photos,user_location, however this means we need to be reviewed by facebook config.omniauth :facebook, ENV['GROWSTUFF_FACEBOOK_KEY'], ENV['GROWSTUFF_FACEBOOK_SECRET'], scope: 'email,public_profile', display: 'page', info_fields: 'email,name,first_name,last_name,id' end - diff --git a/db/migrate/20191119030244_cms_tags.rb b/db/migrate/20191119030244_cms_tags.rb index acaba82c8..87dd06933 100644 --- a/db/migrate/20191119030244_cms_tags.rb +++ b/db/migrate/20191119030244_cms_tags.rb @@ -6,16 +6,16 @@ class CmsTags < ActiveRecord::Migration[5.2] layout.content = layout.content.gsub(%r{\{\{ ?cms:page:([\w/]+) ?\}\}}, '{{ cms:text \1 }}') if layout.content.is_a? String # {{cms:page:page_header:string}} -> {{ cms:text page_header }} - layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):string ?\}\}/, '{{ cms:text \1 }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:page:(\w+):string ?\}\}/, '{{ cms:text \1 }}') if layout.content.is_a? String # {{cms:page:content:rich_text}} -> {{ cms:wysiwyg content }} - layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') if layout.content.is_a? String - layout.content = layout.content.gsub(/\{\{ ?cms:page:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1 }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:page:(\w+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:page:(\w+):([^:]*) ?}}/, '{{ cms:\2 \1 }}') if layout.content.is_a? String if layout.content.is_a? String - layout.content = layout.content.gsub(/\{\{ ?cms:field:([\w]+):string ?\}\}/, '{{ cms:text \1, render: false }}') + layout.content = layout.content.gsub(/\{\{ ?cms:field:(\w+):string ?\}\}/, '{{ cms:text \1, render: false }}') end if layout.content.is_a? String - layout.content = layout.content.gsub(/\{\{ ?cms:field:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1, render: false }}') + layout.content = layout.content.gsub(/\{\{ ?cms:field:(\w+):([^:]*) ?}}/, '{{ cms:\2 \1, render: false }}') end # {{ cms:partial:main/homepage }} -> {{ cms:partial "main/homepage" }} @@ -27,7 +27,7 @@ class CmsTags < ActiveRecord::Migration[5.2] if layout.content.is_a? String layout.content = layout.content.gsub(%r{\{\{ ?cms:(\w+):([\w/-]+):([\w/-]+):([\w/-]+) ?\}\}}, '{{ cms:\1 \2 \3 \4}}') end - layout.content = layout.content.gsub(/\{\{ ?cms:(\w+):([\w]+):([^:]*) ?\}\}/, '{{ cms:\1 \2, "\3" }}') if layout.content.is_a? String + layout.content = layout.content.gsub(/\{\{ ?cms:(\w+):(\w+):([^:]*) ?}}/, '{{ cms:\1 \2, "\3" }}') if layout.content.is_a? String layout.content = layout.content.gsub(/cms:rich_text/, 'cms:wysiwyg') if layout.content.is_a? String layout.content = layout.content.gsub(/cms:integer/, 'cms:number') if layout.content.is_a? String if layout.content.is_a? String @@ -49,20 +49,20 @@ class CmsTags < ActiveRecord::Migration[5.2] fragment.content = fragment.content.gsub(%r{\{\{ ?cms:partial:([\w/]+) ?\}\}}, '{{ cms:partial \1 }}') end - fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):string ?\}\}/, '{{ cms:text \1 }}') if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:(\w+):string ?\}\}/, '{{ cms:text \1 }}') if fragment.content.is_a? String if fragment.content.is_a? String - fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:(\w+):rich_text ?\}\}/, '{{ cms:wysiwyg \1 }}') end fragment.content = fragment.content.gsub(%r{\{\{ ?cms:page:([\w/]+) ?\}\}}, '{{ cms:text \1 }}') if fragment.content.is_a? String - fragment.content = fragment.content.gsub(/\{\{ ?cms:page:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1 }}') if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:page:(\w+):([^:]*) ?}}/, '{{ cms:\2 \1 }}') if fragment.content.is_a? String if fragment.content.is_a? String - fragment.content = fragment.content.gsub(/\{\{ ?cms:field:([\w]+):([^:]*) ?\}\}/, '{{ cms:\2 \1, render: false }}') + fragment.content = fragment.content.gsub(/\{\{ ?cms:field:(\w+):([^:]*) ?}}/, '{{ cms:\2 \1, render: false }}') end - fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):([\w]+) ?\}\}/, '{{ cms:\1 \2 }}') if fragment.content.is_a? String + fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):(\w+) ?\}\}/, '{{ cms:\1 \2 }}') if fragment.content.is_a? String if fragment.content.is_a? String - fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):([\w]+):([^:]*) ?\}\}/, '{{ cms:\1 \2, "\3" }}') + fragment.content = fragment.content.gsub(/\{\{ ?cms:(\w+):(\w+):([^:]*) ?}}/, '{{ cms:\1 \2, "\3" }}') end fragment.save if fragment.changed? end diff --git a/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb index ff5d72c7e..2a0973a97 100644 --- a/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb +++ b/db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb @@ -3,8 +3,6 @@ class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord: def up return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) - if table_exists?(:active_storage_blobs) - add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id - end + add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id if table_exists?(:active_storage_blobs) end end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 6ca836853..db7ffa259 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -5,7 +5,7 @@ require 'cancan/matchers' describe Ability do let(:member) { FactoryBot.create(:member) } - let(:ability) { described_class.new(member) } + let(:ability) { described_class.new(member) } context "notifications" do it 'member can view their own notifications' do diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index b8e53ae88..3b258e7d0 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -54,7 +54,7 @@ describe Photo do # Check the relationship from the photo it { expect(photo.photo_associations.count).to eq 1 } - it { expect(photo.photo_associations.map(&:crop)).to eq [ crop ] } + it { expect(photo.photo_associations.map(&:crop)).to eq [crop] } it { expect(photo.crops.count).to eq 1 } it { expect(photo.crops).to eq [crop] } end @@ -247,7 +247,7 @@ describe Photo do it "finds just one" do expect(described_class.search.count).to eq 1 end - it "finds the matching photo" do + it "finds the matching photo" do expect(described_class.search).to include photo end From c63693a68c250936890cf6e37fb527dcd1cbed0b Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 08:19:29 +1200 Subject: [PATCH 08/72] Rubocop fixes after rails 6 upgrades --- bin/yarn | 12 +++++------- config.ru | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/yarn b/bin/yarn index 460dd565b..b24854dce 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,11 +1,9 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 - end + exec "yarnpkg", *ARGV +rescue Errno::ENOENT + warn "Yarn executable was not detected in the system." + warn "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 end diff --git a/config.ru b/config.ru index 61c04e13f..667e328d5 100644 --- a/config.ru +++ b/config.ru @@ -2,5 +2,5 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('config/environment', __dir__) run Rails.application From 15d72d3769bb878930a7a861adb34101fa188143 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:23:52 +1200 Subject: [PATCH 09/72] Enable the new rubocop cops --- .rubocop.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 9472c8915..deb82e7a6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -60,3 +60,75 @@ Rails/SkipsModelValidations: Exclude: - 'db/migrate/20190317023129_finished_boolean.rb' - 'db/seeds.rb' + + +Layout/EmptyLinesAroundAttributeAccessor: + Enabled: true +Layout/SpaceAroundMethodCallOperator: + Enabled: true +Lint/DeprecatedOpenSSLConstant: + Enabled: true +Lint/DuplicateElsifCondition: + Enabled: true +Lint/MixedRegexpCaptureTypes: + Enabled: true +Lint/RaiseException: + Enabled: true +Lint/StructNewOverride: + Enabled: true +Style/AccessorGrouping: + Enabled: true +Style/ArrayCoercion: + Enabled: true +Style/BisectedAttrAccessor: + Enabled: true +Style/CaseLikeIf: + Enabled: true +Style/ExponentialNotation: + Enabled: true +Style/HashAsLastArrayItem: + Enabled: true +Style/HashEachMethods: + Enabled: true +Style/HashLikeCase: + Enabled: true +Style/HashTransformKeys: + Enabled: true +Style/HashTransformValues: + Enabled: true +Style/RedundantAssignment: + Enabled: true +Style/RedundantFetchBlock: + Enabled: true +Style/RedundantFileExtensionInRequire: + Enabled: true +Style/RedundantRegexpCharacterClass: + Enabled: true +Style/RedundantRegexpEscape: + Enabled: true +Style/SlicingWithRange: + Enabled: true +Rails/ActiveRecordCallbacksOrder: + Enabled: true +Rails/FindById: + Enabled: true +Rails/Inquiry: + Enabled: true +Rails/MailerName: + Enabled: true +Rails/MatchRoute: + Enabled: true +Rails/NegateInclude: + Enabled: true +Rails/Pluck: + Enabled: true +Rails/PluckInWhere: + Enabled: true +Rails/RenderInline: + Enabled: true +Rails/RenderPlainText: + Enabled: true +Rails/ShortI18n: + Enabled: true +Rails/WhereExists: + Enabled: true From 5573fbfbb60f86d44614e5313566e4ec346fd154 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 08:30:10 +1200 Subject: [PATCH 10/72] foreign key declarations not needed anymore --- app/models/concerns/ownable.rb | 3 +-- app/models/photo.rb | 2 +- app/models/planting.rb | 7 +++---- app/models/post.rb | 2 +- app/models/seed.rb | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/concerns/ownable.rb b/app/models/concerns/ownable.rb index 8dac572a5..f6405ddc6 100644 --- a/app/models/concerns/ownable.rb +++ b/app/models/concerns/ownable.rb @@ -4,8 +4,7 @@ module Ownable extend ActiveSupport::Concern included do - belongs_to :owner, class_name: 'Member', - foreign_key: 'owner_id', counter_cache: true + belongs_to :owner, class_name: 'Member', counter_cache: true default_scope { joins(:owner).merge(Member.kept) } # Ensures the owner still exists end diff --git a/app/models/photo.rb b/app/models/photo.rb index 18cf971f7..64bf79348 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -7,7 +7,7 @@ class Photo < ApplicationRecord PHOTO_CAPABLE = %w(Garden Planting Harvest Seed Post Crop).freeze - has_many :photo_associations, foreign_key: :photo_id, dependent: :delete_all, inverse_of: :photo + has_many :photo_associations, dependent: :delete_all, inverse_of: :photo # This doesn't work, ActiveRecord tries to use the polymoriphinc photographable # relationship instead. diff --git a/app/models/planting.rb b/app/models/planting.rb index dc73b196c..3247fc015 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -25,10 +25,9 @@ class Planting < ApplicationRecord # # Ancestry of food - belongs_to :parent_seed, class_name: 'Seed', # parent - foreign_key: 'parent_seed_id', - optional: true, - inverse_of: :child_plantings + belongs_to :parent_seed, class_name: 'Seed', # parent, + optional: true, + inverse_of: :child_plantings has_many :child_seeds, class_name: 'Seed', # children foreign_key: 'parent_planting_id', inverse_of: :parent_planting, diff --git a/app/models/post.rb b/app/models/post.rb index 3a1dc548c..d84e2dc5d 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -14,10 +14,10 @@ class Post < ApplicationRecord has_many :crop_posts, dependent: :delete_all has_many :crops, through: :crop_posts + after_create :send_notification # # Triggers after_save :update_crop_posts_association - after_create :send_notification default_scope { joins(:author).merge(Member.kept) } # Ensures the owner still exists diff --git a/app/models/seed.rb b/app/models/seed.rb index 2e853462f..761f40ffe 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -16,7 +16,7 @@ class Seed < ApplicationRecord # # Relationships belongs_to :crop - belongs_to :parent_planting, class_name: 'Planting', foreign_key: 'parent_planting_id', + belongs_to :parent_planting, class_name: 'Planting', optional: true, inverse_of: :child_seeds # parent has_many :child_plantings, class_name: 'Planting', foreign_key: 'parent_seed_id', dependent: :nullify, From 64ce6ef886ed69aeb007724d27588e0071cade0b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:32:57 +1200 Subject: [PATCH 11/72] Align end --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aae956656..a84b5d6b7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,7 +75,7 @@ module ApplicationHelper public_send("crop_#{type}_path", crop, all: all) else public_send("#{type}_path", all: all) - end + end end def title(type, owner, crop, planting) From 59e0a13f42a6fc6ffe2079c1320fbc45cbb7590d Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 08:34:02 +1200 Subject: [PATCH 12/72] removed redundant assignment --- lib/actions/oauth_signup_action.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb index dd81d2ec9..4cc790bd5 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -41,7 +41,7 @@ class Growstuff::OauthSignupAction def establish_authentication(auth, member) name = determine_name(auth) - authentication = member.authentications + member.authentications .create_with( name: name, token: auth['credentials']['token'], @@ -53,8 +53,6 @@ class Growstuff::OauthSignupAction name: name, member_id: member.id ) - - authentication end def member_created? From 13c675d6f7a52b095019664865a0744bfbfb2f50 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 08:43:17 +1200 Subject: [PATCH 13/72] rewrote order by to not be raw sql --- app/models/comment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 4ac02ba34..6590b6649 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -4,7 +4,7 @@ class Comment < ApplicationRecord belongs_to :author, class_name: 'Member', inverse_of: :comments belongs_to :post, counter_cache: true - scope :post_order, -> { reorder("created_at ASC") } # for display on post page + scope :post_order, -> { order(created_at: :asc) } # for display on post page after_create do recipient = post.author.id From 8a5a19f0c606e0938af47d057002aecc7b1027a6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:50:20 +1200 Subject: [PATCH 14/72] Removing deprecated commented out parts of application.rb --- config/application.rb | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/config/application.rb b/config/application.rb index b86ae6c53..fc4928511 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,21 +12,7 @@ Bundler.require(*Rails.groups) module Growstuff class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + config.load_defaults 6.0 I18n.config.enforce_available_locales = true @@ -52,17 +38,6 @@ module Growstuff # Enable escaping HTML in JSON. config.active_support.escape_html_entities_in_json = true - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - # config.active_record.whitelist_attributes = true - # Enable the asset pipeline config.assets.enabled = true @@ -93,17 +68,6 @@ module Growstuff Gibbon::API.throws_exceptions = false config.newsletter_list_id = ENV['GROWSTUFF_MAILCHIMP_NEWSLETTER_ID'] - # This is Growstuff's global Cloudmade key. If you fork Growstuff for - # another project/website not run by the folks at http://growstuff.org/, - # then please change this key. (You can get one of your own at - # http://account.cloudmade.com/ and it's free/gratis for up to 500k tiles.) - # We'd much prefer to set this as an environment variable (as we do - # with most other things) but it turns out those aren't available at - # asset compile time on Heroku, when we need this to insert into our - # Javascript. Sigh. And yes, we know about user-env-compile but it - # didn't work for us. - config.cloudmade_key = '29a2d9e3cb3d429490a8f338b2388b1d' - # config.active_record.raise_in_transactional_callbacks = true config.middleware.insert_before 0, Rack::Cors do allow do From 23fac43caddbb412746c6c97fd4b3571cc3a05a5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:50:39 +1200 Subject: [PATCH 15/72] Removing link to cloudmade because they no longer exist and the domain is used by something else now --- app/views/places/_map_attribution.html.haml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/places/_map_attribution.html.haml b/app/views/places/_map_attribution.html.haml index f6c2e2a28..7637a1ebf 100644 --- a/app/views/places/_map_attribution.html.haml +++ b/app/views/places/_map_attribution.html.haml @@ -3,4 +3,3 @@ Map data © contributors under = link_to "ODbL", "https://www.openstreetmap.org/copyright" | Imagery © -= link_to "CloudMade", "https://cloudmade.com" From 234c3c604f1e37a0cab162658fe31fdcd3fa71d7 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 08:56:13 +1200 Subject: [PATCH 16/72] Rubocop target is rails 6.0 --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index deb82e7a6..ac9a71372 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ AllCops: Exclude: - 'db/schema.rb' - 'vendor/**/*' - TargetRailsVersion: 5.2 + TargetRailsVersion: 6.0 Rails: Enabled: true From 16895d2ddb1c20547d6f78e74bc5c7800d8bb4ad Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 09:03:47 +1200 Subject: [PATCH 17/72] Added missing unique constraint to garden_types --- db/migrate/20200801210054_missing_uniqueness.rb | 8 ++++++++ db/schema.rb | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200801210054_missing_uniqueness.rb diff --git a/db/migrate/20200801210054_missing_uniqueness.rb b/db/migrate/20200801210054_missing_uniqueness.rb new file mode 100644 index 000000000..8b7580727 --- /dev/null +++ b/db/migrate/20200801210054_missing_uniqueness.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class MissingUniqueness < ActiveRecord::Migration[6.0] + def change + add_index(:garden_types, [:name], unique: true) + add_index(:garden_types, [:slug], unique: true) + end +end diff --git a/db/schema.rb b/db/schema.rb index f41c856d3..0d3042c9e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_08_01_084007) do +ActiveRecord::Schema.define(version: 2020_08_01_210054) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -225,6 +225,8 @@ ActiveRecord::Schema.define(version: 2020_08_01_084007) do t.text "slug", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["name"], name: "index_garden_types_on_name", unique: true + t.index ["slug"], name: "index_garden_types_on_slug", unique: true end create_table "gardens", id: :serial, force: :cascade do |t| From ef37f74c0f7526a316c6d4c95bd17fb2ac8bac57 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 2 Aug 2020 09:12:33 +1200 Subject: [PATCH 18/72] Splitting up complex method in photos controller --- app/controllers/photos_controller.rb | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 322c5a66e..739878909 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -2,6 +2,7 @@ class PhotosController < ApplicationController before_action :authenticate_member!, except: %i(index show) + before_action :set_crop_and_planting, only: :index after_action :expire_homepage, only: %i(create destroy) load_and_authorize_resource respond_to :html, :json @@ -13,19 +14,10 @@ class PhotosController < ApplicationController end def index - where = {} - if params[:crop_slug] - @crop = Crop.find params[:crop_slug] - where = { crops: @crop.id } - elsif params[:planting_id] - @planting = Planting.find params[:planting_id] - where = { planting_id: @planting.id } - end - @photos = Photo.search( load: false, boost_by: [:created_at], - where: where, + where: index_where_clause, page: params[:page], limit: Photo.per_page ) @@ -112,4 +104,19 @@ class PhotosController < ApplicationController pager.replace photos end end + + def index_where_clause + if params[:crop_slug] + { crops: @crop.id } + elsif params[:planting_id] + { planting_id: @planting.id } + else + {} + end + end + + def set_crop_and_planting + @crop = Crop.find params[:crop_slug] if params[:crop_slug] + @planting = Planting.find params[:planting_id] if params[:planting_id] + end end From 967ae2208851854d341925f80d6f855e5926a715 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 09:16:46 +1200 Subject: [PATCH 19/72] Apply suggestions from code review --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index ac9a71372..2dd325278 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -81,7 +81,7 @@ Style/AccessorGrouping: Style/ArrayCoercion: Enabled: true Style/BisectedAttrAccessor: - Enabled: true + Enabled: false Style/CaseLikeIf: Enabled: true Style/ExponentialNotation: From 6a485e9f5f34a46f7a510d4f18025883be230d37 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 09:18:28 +1200 Subject: [PATCH 20/72] Disabling brakeman on codeclimate because it doesn't understand rails 6 --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index a16f0902f..bbdfa5476 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -11,7 +11,7 @@ engines: coffeelint: enabled: true brakeman: - enabled: true + enabled: false bundler-audit: enabled: true duplication: From 958ee66e7978897238d4abb775fa74e08bd9d41f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 09:22:13 +1200 Subject: [PATCH 21/72] Apply suggestions from code review --- bin/setup | 2 ++ bin/yarn | 1 + config/puma.rb | 2 ++ 3 files changed, 5 insertions(+) diff --git a/bin/setup b/bin/setup index 5853b5ea8..ac9f62467 100755 --- a/bin/setup +++ b/bin/setup @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require 'fileutils' # path to your application root. diff --git a/bin/yarn b/bin/yarn index b24854dce..d64964dfa 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,4 +1,5 @@ #!/usr/bin/env ruby + # frozen_string_literal: true APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do exec "yarnpkg", *ARGV diff --git a/config/puma.rb b/config/puma.rb index 5ed443774..a47b28904 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match From 33944adf6c25b89ba76169725fd816abca0fb816 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 09:24:54 +1200 Subject: [PATCH 22/72] Rubocop indentation fixes --- bin/yarn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/yarn b/bin/yarn index d64964dfa..268a9398f 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,5 +1,6 @@ #!/usr/bin/env ruby - # frozen_string_literal: true +# frozen_string_literal: true + APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do exec "yarnpkg", *ARGV From 4906aaa180bd9485a6849163bc155e32f5c207ca Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 13:46:01 +1200 Subject: [PATCH 23/72] Rename Notifer to NotifierMailer --- app/controllers/crops_controller.rb | 6 +++--- app/mailers/{notifier.rb => notifier_mailer.rb} | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/mailers/{notifier.rb => notifier_mailer.rb} (98%) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index baf56aa1a..1e49f8a3e 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -145,9 +145,9 @@ class CropsController < ApplicationController def notifier case @crop.approval_status when "approved" - Notifier.crop_request_approved(@crop.requester, @crop) + NotifierMailer.crop_request_approved(@crop.requester, @crop) when "rejected" - Notifier.crop_request_rejected(@crop.requester, @crop) + NotifierMailer.crop_request_rejected(@crop.requester, @crop) end end @@ -164,7 +164,7 @@ class CropsController < ApplicationController return if current_member.role? :crop_wrangler Role.crop_wranglers&.each do |w| - Notifier.new_crop_request(w, @crop).deliver_now! + NotifierMailer.new_crop_request(w, @crop).deliver_now! end end diff --git a/app/mailers/notifier.rb b/app/mailers/notifier_mailer.rb similarity index 98% rename from app/mailers/notifier.rb rename to app/mailers/notifier_mailer.rb index c2b68d796..345c3cad3 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier_mailer.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Notifier < ApplicationMailer +class NotifierMailer < ApplicationMailer # include NotificationsHelper default from: "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>" From 133f0a563f95d9c64a780c78413b053f845510fe Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 13:53:22 +1200 Subject: [PATCH 24/72] Add active median in test runner on travis-ci --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 661372812..587160ed3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ script: ./script/check_static.rb else bundle exec rails db:create db:migrate; + bundle exec rails runner "ActiveMedian.create_function"; bundle exec rails assets:precompile; bundle exec rails search:reindex; bundle exec rspec spec; From 9ecab8358e54a2e4c7604d1ac9d920af3c8e1558 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 13:54:01 +1200 Subject: [PATCH 25/72] run travis-ci as test --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 587160ed3..93cb90e35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,8 @@ env: - secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4=" - GROWSTUFF_EMAIL="noreply@test.growstuff.org"g - GROWSTUFF_SITE_NAME="Growstuff (travis)" - - RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + - RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] + - RAILS_ENV=test before_install: - sudo apt clean - sudo apt update From 328afa91fab50c64f010c1b23f4fc1860e5bca41 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 13:56:16 +1200 Subject: [PATCH 26/72] removed redundant escaping --- lib/haml/filters/growstuff_markdown.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb index d5869e7fb..5295140e4 100644 --- a/lib/haml/filters/growstuff_markdown.rb +++ b/lib/haml/filters/growstuff_markdown.rb @@ -17,8 +17,8 @@ module Haml::Filters CROP_REGEX = /(? Date: Sun, 2 Aug 2020 13:57:20 +1200 Subject: [PATCH 27/72] Prefer ary[n..] over ary[n..-1]. --- app/models/post.rb | 2 +- lib/haml/filters/growstuff_markdown.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index d84e2dc5d..057402187 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -82,7 +82,7 @@ class Post < ApplicationRecord end body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |_m| # find member case-insensitively and add to list of recipients - member = Member.case_insensitive_login_name(Regexp.last_match(1)[1..-1]).first + member = Member.case_insensitive_login_name(Regexp.last_match(1)[1..]).first recipients << member if member && recipients.exclude?(member) end # don't send notifications to yourself diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb index 5295140e4..e84465be1 100644 --- a/lib/haml/filters/growstuff_markdown.rb +++ b/lib/haml/filters/growstuff_markdown.rb @@ -65,7 +65,7 @@ module Haml::Filters def find_member(login_name) # Remove @ if present - login_name = login_name[1..-1] if login_name.start_with?('@') + login_name = login_name[1..] if login_name.start_with?('@') Member.case_insensitive_login_name(login_name).first end end From 63caea1a6a652f4ec72ad5d4aeab67d8a45fc07d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 14:45:45 +1200 Subject: [PATCH 28/72] Use member.kpt in auth --- Gemfile | 2 +- Gemfile.lock | 2 +- lib/actions/oauth_signup_action.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 6f379f9c0..5c759d5e4 100644 --- a/Gemfile +++ b/Gemfile @@ -112,7 +112,7 @@ gem 'rake', '>= 10.0.0' gem "responders" # allows soft delete. Used for members. -gem 'discard', '~> 1.0' +gem 'discard', '~> 1.2' gem 'xmlrpc' # fixes rake error - can be removed if not needed later diff --git a/Gemfile.lock b/Gemfile.lock index 9c331732a..223e87046 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -644,7 +644,7 @@ DEPENDENCIES dalli database_cleaner devise - discard (~> 1.0) + discard (~> 1.2) dotenv-rails elasticsearch (< 7.0.0) factory_bot_rails diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb index 4cc790bd5..63e6dd4f5 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -11,7 +11,7 @@ class Growstuff::OauthSignupAction # variable # def find_or_create_from_authorization(auth) - member ||= Member.where(email: auth.info.email).first_or_create do |m| + member ||= Member.kept.where(email: auth.info.email).first_or_create do |m| m.email = auth.info.email m.password = Devise.friendly_token[0, 20] From f1d830bfa971370dbf80455356c1a7eb65890dab Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 2 Aug 2020 14:45:55 +1200 Subject: [PATCH 29/72] fixed ambiguous negative --- spec/controllers/crops_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index 8681b4790..daec0591e 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -85,7 +85,7 @@ describe CropsController do context 'wrangler' do include_context 'login as wrangler' - it { expect { subject }.to change(Crop, :count).by -1 } + it { expect { subject }.to change(Crop, :count).by(-1) } end end end From 05dabd0ded32f1c6eb736169a4d78fbf15c22f25 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 3 Aug 2020 14:24:06 +1200 Subject: [PATCH 30/72] ensure the activemedian methods are in the test db --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 93cb90e35..2caf75ac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ script: ./script/check_static.rb else bundle exec rails db:create db:migrate; - bundle exec rails runner "ActiveMedian.create_function"; + RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; bundle exec rails assets:precompile; bundle exec rails search:reindex; bundle exec rspec spec; From fb37cf8843ce9d402e6deb69bb7611d702a0e5ac Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 4 Aug 2020 16:19:03 +1200 Subject: [PATCH 31/72] Adding github actions --- .github/dependabot.yml | 15 +++++++ .github/workflows/ci.yml | 94 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..a1b3e6fd7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: '17:00' + open-pull-requests-limit: 10 +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: '17:00' + open-pull-requests-limit: 10 + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f42987dd4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + pull_request: + push: + branches: + - mainline + - dev + +jobs: + test: + runs-on: ubuntu-latest + services: + db: + image: postgres + env: + ## + # The Postgres service fails its docker health check unless you + # specify these environment variables + # + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: growstuff_test + ports: ['5432:5432'] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Checkout this repo + uses: actions/checkout@v2 + + ## + # Cache Yarn modules + # + # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details + # + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Setup yarn cache + uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install required OS packages + run: | + sudo apt-get -y install libpq-dev google-chrome-stable + + - name: Install NodeJS + uses: actions/setup-node@v2-beta + with: + node-version: '12' + + - name: Install ruby version specified in .ruby-version + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Install JS dependencies + run: yarn install + + - name: Setup codeclimate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + + - name: Prepare database for testing + env: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test + DEVISE_SECRET_KEY: growstuff + RAILS_ENV: test + run: | + bundle exec rails db:prepare + + - name: Run rspec (report results to Percy.io and codeclimate) + env: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test + DEVISE_SECRET_KEY: growstuff + growstuff_ONLINE_SECRET_KEY_BASE: growstuff + APP_DOMAIN_NAME: localhost:3000 + APP_PROTOCOL: http + + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + run: | + bundle exec rspec spec + ./cc-test-reporter after-build --exit-code $? From 5f2010daa2ec003ce7d9c7e0cc15e319ac25d947 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 09:29:45 +1200 Subject: [PATCH 32/72] Ensuring the postgresql media functions exist --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2caf75ac7..cc605c096 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,7 @@ script: ./script/check_static.rb else bundle exec rails db:create db:migrate; + RAILS_ENV=dev bundle exec rails runner "ActiveMedian.create_function"; RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; bundle exec rails assets:precompile; bundle exec rails search:reindex; From bcc722d0c269f1199a7b9e14936b9a5640841106 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 09:32:35 +1200 Subject: [PATCH 33/72] Updating content type in tests to include charset --- spec/controllers/comments_controller_spec.rb | 2 +- spec/controllers/crops_controller_spec.rb | 2 +- spec/controllers/member_controller_spec.rb | 2 +- spec/controllers/posts_controller_spec.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 4e8b64ce4..07e0115e6 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -26,7 +26,7 @@ describe CommentsController do it { is_expected.to be_successful } it { is_expected.to render_template("comments/index") } - it { expect(response.content_type).to eq("application/rss+xml") } + it { expect(response.content_type).to eq("application/rss+xml; charset=utf-8") } it { expect(assigns(:comments)).to eq([last_comment, first_comment]) } end end diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index daec0591e..826888266 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -66,7 +66,7 @@ describe CropsController do it { is_expected.to be_successful } it { is_expected.to render_template("crops/index") } - it { expect(response.content_type).to eq("application/rss+xml") } + it { expect(response.content_type).to eq("application/rss+xml; charset=utf-8") } end end diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb index 6e6997e93..dad64c564 100644 --- a/spec/controllers/member_controller_spec.rb +++ b/spec/controllers/member_controller_spec.rb @@ -57,7 +57,7 @@ describe MembersController do it { expect(response).to be_successful } it { expect(response).to render_template("members/show") } - it { expect(response.content_type).to eq("application/rss+xml") } + it { expect(response.content_type).to eq("application/rss+xml; charset=utf-8") } end end end diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index 1bae41f14..9d88254ac 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -31,7 +31,7 @@ describe PostsController do get :index, format: "rss" expect(response).to be_successful expect(response).to render_template("posts/index") - expect(response.content_type).to eq("application/rss+xml") + expect(response.content_type).to eq("application/rss+xml; charset=utf-8") end end @@ -41,7 +41,7 @@ describe PostsController do get :show, format: "rss", params: { id: post.slug } expect(response).to be_successful expect(response).to render_template("posts/show") - expect(response.content_type).to eq("application/rss+xml") + expect(response.content_type).to eq("application/rss+xml; charset=utf-8") end end end From 8016a35e49e635b9c138ddc2797a78dfbc6f6595 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 09:48:42 +1200 Subject: [PATCH 34/72] Adding contributor check to github actions --- .github/workflows/ci.yml | 31 +++++++++++++++-------- spec/controllers/likes_controller_spec.rb | 4 +-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f42987dd4..e15fd73ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,27 @@ on: - dev jobs: + contributors: + runs-on: ubuntu-latest + steps: + - name: Install ruby version specified in .ruby-version + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - name: Install gem bundle + run: | + gem install bundler + bundle install + - name: Check contributors + run: | + bundle exec script/check_contributors_md.rb + test: runs-on: ubuntu-latest services: db: image: postgres env: - ## - # The Postgres service fails its docker health check unless you - # specify these environment variables - # POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: growstuff_test @@ -32,14 +43,10 @@ jobs: - name: Checkout this repo uses: actions/checkout@v2 - ## - # Cache Yarn modules - # - # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details - # - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Setup yarn cache uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) @@ -63,6 +70,11 @@ jobs: with: bundler-cache: true + - name: Install gem bundle + run: | + gem install bundler + bundle install + - name: Install JS dependencies run: yarn install @@ -87,7 +99,6 @@ jobs: growstuff_ONLINE_SECRET_KEY_BASE: growstuff APP_DOMAIN_NAME: localhost:3000 APP_PROTOCOL: http - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} run: | bundle exec rspec spec diff --git a/spec/controllers/likes_controller_spec.rb b/spec/controllers/likes_controller_spec.rb index cc1bf9ba5..dcbb7b66b 100644 --- a/spec/controllers/likes_controller_spec.rb +++ b/spec/controllers/likes_controller_spec.rb @@ -12,7 +12,7 @@ describe LikesController do describe "POST create" do before { post :create, params: { type: 'Post', id: blogpost.id, format: :json } } - it { expect(response.content_type).to eq "application/json" } + it { expect(response.content_type).to eq "application/json; charset=utf-8" } it { expect(Like.last.likeable_id).to eq(blogpost.id) } it { expect(Like.last.likeable_type).to eq('Post') } @@ -29,7 +29,7 @@ describe LikesController do describe "DELETE destroy" do before { delete :destroy, params: { type: like.likeable_type, id: like.likeable_id, format: :json } } - it { expect(response.content_type).to eq "application/json" } + it { expect(response.content_type).to eq "application/json; charset=utf-8" } describe "un-liking something i liked before" do it { expect(response.code).to eq('200') } From 9b6a1b9fce080bfea827de24daa2dfd33ac8c37a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:14:41 +1200 Subject: [PATCH 35/72] Removed contributor check from travis --- .travis.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc605c096..dd875c966 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,16 +9,15 @@ cache: directories: - tmp/cache/assets/test/sprockets addons: - postgresql: "9.4" + postgresql: "9.4" # Matches production code_climate: repo_token: secure: "PfhLGBKRgNqhKuYCJsK+VPhdAzcgWFGeeOyxC/eS8gtlvIISVdgyZE+r30uIei0DFI6zEiN62eW4d+xtT4j7/e2ZcAcx7U52mza/SnQNuu3nCGQDJB8VOvV5NbnwXfi8vfr4e889Mt7k3ocd2c4gqB4UtRqrzhygj7HN+B/GfEk=" env: - matrix: - - ELASTIC_SEARCH_VERSION="7.5.1-amd64" COVERAGE=true RAILS_ENV=test # Future target (production needs upgrading) - - STATIC_CHECKS=true global: - secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4=" + - ELASTIC_SEARCH_VERSION="7.5.1-amd64" + - COVERAGE=true - GROWSTUFF_EMAIL="noreply@test.growstuff.org"g - GROWSTUFF_SITE_NAME="Growstuff (travis)" - RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] @@ -33,23 +32,16 @@ before_install: - ./script/check_elasticsearch.sh script: - > - if [ "${STATIC_CHECKS}" = "true" ]; then - ./script/check_static.rb - else - bundle exec rails db:create db:migrate; - RAILS_ENV=dev bundle exec rails runner "ActiveMedian.create_function"; - RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; - bundle exec rails assets:precompile; - bundle exec rails search:reindex; - bundle exec rspec spec; - # npx percy exec -- bundle exec rspec spec # <- run this to send screen shots to percy - fi; + bundle exec rails db:create db:migrate; + RAILS_ENV=dev bundle exec rails runner "ActiveMedian.create_function"; + RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; + bundle exec rails assets:precompile; + bundle exec rails search:reindex; + bundle exec rspec spec; after_script: - > - if [ "${COVERAGE}" = "true" ]; then - gem install codeclimate-test-reporter - codeclimate-test-reporter - fi + gem install codeclimate-test-reporter + codeclimate-test-reporter before_deploy: - bundle exec script/heroku_maintenance.rb on deploy: From 18750063e8d7c5d140f864b39b2cd9bc84ec8e9c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:15:47 +1200 Subject: [PATCH 36/72] Prepare database in travis run --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd875c966..159ea4f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_install: script: - > bundle exec rails db:create db:migrate; - RAILS_ENV=dev bundle exec rails runner "ActiveMedian.create_function"; + bundle exec rails db:prepare RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; bundle exec rails assets:precompile; bundle exec rails search:reindex; From bf6e2719a4dea09913eddc7a391aeb73445e37de Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:17:31 +1200 Subject: [PATCH 37/72] Update name from Notifier to NotifierMailer --- spec/features/planting_reminder_spec.rb | 2 +- spec/features/unsubscribing_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/planting_reminder_spec.rb b/spec/features/planting_reminder_spec.rb index 8ac7703a0..55bc4f88d 100644 --- a/spec/features/planting_reminder_spec.rb +++ b/spec/features/planting_reminder_spec.rb @@ -5,7 +5,7 @@ require 'capybara/email/rspec' describe "Planting reminder email", :js do let(:member) { create :member } - let(:mail) { Notifier.planting_reminder(member) } + let(:mail) { NotifierMailer.planting_reminder(member) } # Unfortunately, we can't use the default url options for ActionMailer as configured in # test.rb, since this isn't a mailer spec. diff --git a/spec/features/unsubscribing_spec.rb b/spec/features/unsubscribing_spec.rb index 9fff6084b..d5553dbeb 100644 --- a/spec/features/unsubscribing_spec.rb +++ b/spec/features/unsubscribing_spec.rb @@ -16,7 +16,7 @@ describe "unsubscribe" do expect(member.send_notification_email).to eq(true) # generate planting reminder email - Notifier.planting_reminder(member).deliver_now + NotifierMailer.planting_reminder(member).deliver_now open_email(member.email) # clicking 'Unsubscribe' link will unsubscribe the member @@ -35,7 +35,7 @@ describe "unsubscribe" do # generate inbox notification email notification.recipient = member - Notifier.notify(notification).deliver_now + NotifierMailer.notify(notification).deliver_now open_email(member.email) # clicking 'Unsubscribe' link will unsubscribe the member From c1922e5bc3d605abee1ac1bb26df7897b6ba4a04 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:43:33 +1200 Subject: [PATCH 38/72] Remove extra env variable --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 159ea4f94..f3c882f61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - > bundle exec rails db:create db:migrate; bundle exec rails db:prepare - RAILS_ENV=test bundle exec rails runner "ActiveMedian.create_function"; + bundle exec rails runner "ActiveMedian.create_function"; bundle exec rails assets:precompile; bundle exec rails search:reindex; bundle exec rspec spec; From d6aefc1ac70892b359aae792672c3643302cd161 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:49:35 +1200 Subject: [PATCH 39/72] seperate steps on travis --- .travis.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3c882f61..bd524b24b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,13 +31,12 @@ before_install: - ./script/install_linters.sh - ./script/check_elasticsearch.sh script: - - > - bundle exec rails db:create db:migrate; - bundle exec rails db:prepare - bundle exec rails runner "ActiveMedian.create_function"; - bundle exec rails assets:precompile; - bundle exec rails search:reindex; - bundle exec rspec spec; + - bundle exec rails db:create db:migrate + - bundle exec rails db:prepare + - bundle exec rails runner "ActiveMedian.create_function" + - bundle exec rails assets:precompile + - bundle exec rails search:reindex + - bundle exec rspec spec after_script: - > gem install codeclimate-test-reporter From 2ab935918c9d455107f5d31017988a1d362c3c1c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:51:45 +1200 Subject: [PATCH 40/72] Removed extra steps on travis --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd524b24b..ba5e4fded 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,11 +32,9 @@ before_install: - ./script/check_elasticsearch.sh script: - bundle exec rails db:create db:migrate - - bundle exec rails db:prepare - - bundle exec rails runner "ActiveMedian.create_function" - bundle exec rails assets:precompile - bundle exec rails search:reindex - - bundle exec rspec spec + - bundle exec rspec spec -fd after_script: - > gem install codeclimate-test-reporter From 0a604ede5231f6851cc34a12dbbf9bd1da3a3a74 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 10:52:59 +1200 Subject: [PATCH 41/72] Run github actions on push, pull request --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e15fd73ce..37afc6e58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,6 @@ name: CI -on: - pull_request: - push: - branches: - - mainline - - dev +on: [push, pull_request] jobs: contributors: From ec778394abd567ba42c9b815273d2538e63e549a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 13:26:49 +1200 Subject: [PATCH 42/72] Upgrade to activemedian 0.2.0 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- db/migrate/20200815012538_remove_median_function.rb | 6 ++++++ db/schema.rb | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20200815012538_remove_median_function.rb diff --git a/Gemfile b/Gemfile index 5c759d5e4..561fa6c9b 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ gem 'oj' # Speeds up json # planting and harvest predictions # based on median values for the crop -gem 'active_median', '0.1.4' # needs postgresql update https://github.com/Growstuff/growstuff/issues/1757 +gem 'active_median', '0.2.0' gem 'active_record_union' gem 'flickraw' diff --git a/Gemfile.lock b/Gemfile.lock index 223e87046..12306e66e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,8 +42,8 @@ GEM active_link_to (1.0.5) actionpack addressable - active_median (0.1.4) - activerecord + active_median (0.2.0) + activerecord (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) active_utils (3.3.17) @@ -619,7 +619,7 @@ PLATFORMS ruby DEPENDENCIES - active_median (= 0.1.4) + active_median (= 0.2.0) active_record_union active_utils better_errors diff --git a/db/migrate/20200815012538_remove_median_function.rb b/db/migrate/20200815012538_remove_median_function.rb new file mode 100644 index 000000000..fd7118978 --- /dev/null +++ b/db/migrate/20200815012538_remove_median_function.rb @@ -0,0 +1,6 @@ +class RemoveMedianFunction < ActiveRecord::Migration[6.0] + def change + # No longer needed, after upgrading to activemedian 0.2.0 + ActiveMedian.drop_function + end +end diff --git a/db/schema.rb b/db/schema.rb index 0d3042c9e..0d0d6a357 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_08_01_210054) do +ActiveRecord::Schema.define(version: 2020_08_15_012538) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" From 96f40c9c6b88a7aeb42b302d9c5ef14cba4136b2 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 13:32:11 +1200 Subject: [PATCH 43/72] Comment out a migration that needs an old gem to work --- db/migrate/20171028230429_create_median_function.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/migrate/20171028230429_create_median_function.rb b/db/migrate/20171028230429_create_median_function.rb index 1b1e44e57..ec86bced1 100644 --- a/db/migrate/20171028230429_create_median_function.rb +++ b/db/migrate/20171028230429_create_median_function.rb @@ -2,10 +2,11 @@ class CreateMedianFunction < ActiveRecord::Migration[4.2] def up - ActiveMedian.create_function + # commented out, because we upgraded the gem later and this function was removed + # ActiveMedian.create_function end def down - ActiveMedian.drop_function + # ActiveMedian.drop_function end end From b9c411d3851ec56ed1229e242c36ddef64bd255e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:00:04 +1200 Subject: [PATCH 44/72] Removed cloudmade test --- spec/views/places/_map_attribution.html.haml_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/views/places/_map_attribution.html.haml_spec.rb b/spec/views/places/_map_attribution.html.haml_spec.rb index 9b869a304..b52896bc2 100644 --- a/spec/views/places/_map_attribution.html.haml_spec.rb +++ b/spec/views/places/_map_attribution.html.haml_spec.rb @@ -16,8 +16,4 @@ describe "places/_map_attribution.html.haml", type: :view do assert_select "a", href: "http://www.openstreetmap.org/copyright", text: "ODbL" end - - it "links to CloudMade" do - assert_select "a", href: "http://cloudmade.com", text: "CloudMade" - end end From 83699656e473429706d47c9e83850373fb08edbc Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:02:23 +1200 Subject: [PATCH 45/72] Renaming notifier to new rails 6 style --- app/views/{notifier => notifier_mailer}/_planting.haml | 0 app/views/{notifier => notifier_mailer}/_signature.html.haml | 0 .../{notifier => notifier_mailer}/crop_request_approved.html.haml | 0 .../{notifier => notifier_mailer}/crop_request_rejected.html.haml | 0 .../{notifier => notifier_mailer}/new_crop_request.html.haml | 0 app/views/{notifier => notifier_mailer}/notify.html.haml | 0 .../{notifier => notifier_mailer}/planting_reminder.html.haml | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename app/views/{notifier => notifier_mailer}/_planting.haml (100%) rename app/views/{notifier => notifier_mailer}/_signature.html.haml (100%) rename app/views/{notifier => notifier_mailer}/crop_request_approved.html.haml (100%) rename app/views/{notifier => notifier_mailer}/crop_request_rejected.html.haml (100%) rename app/views/{notifier => notifier_mailer}/new_crop_request.html.haml (100%) rename app/views/{notifier => notifier_mailer}/notify.html.haml (100%) rename app/views/{notifier => notifier_mailer}/planting_reminder.html.haml (100%) diff --git a/app/views/notifier/_planting.haml b/app/views/notifier_mailer/_planting.haml similarity index 100% rename from app/views/notifier/_planting.haml rename to app/views/notifier_mailer/_planting.haml diff --git a/app/views/notifier/_signature.html.haml b/app/views/notifier_mailer/_signature.html.haml similarity index 100% rename from app/views/notifier/_signature.html.haml rename to app/views/notifier_mailer/_signature.html.haml diff --git a/app/views/notifier/crop_request_approved.html.haml b/app/views/notifier_mailer/crop_request_approved.html.haml similarity index 100% rename from app/views/notifier/crop_request_approved.html.haml rename to app/views/notifier_mailer/crop_request_approved.html.haml diff --git a/app/views/notifier/crop_request_rejected.html.haml b/app/views/notifier_mailer/crop_request_rejected.html.haml similarity index 100% rename from app/views/notifier/crop_request_rejected.html.haml rename to app/views/notifier_mailer/crop_request_rejected.html.haml diff --git a/app/views/notifier/new_crop_request.html.haml b/app/views/notifier_mailer/new_crop_request.html.haml similarity index 100% rename from app/views/notifier/new_crop_request.html.haml rename to app/views/notifier_mailer/new_crop_request.html.haml diff --git a/app/views/notifier/notify.html.haml b/app/views/notifier_mailer/notify.html.haml similarity index 100% rename from app/views/notifier/notify.html.haml rename to app/views/notifier_mailer/notify.html.haml diff --git a/app/views/notifier/planting_reminder.html.haml b/app/views/notifier_mailer/planting_reminder.html.haml similarity index 100% rename from app/views/notifier/planting_reminder.html.haml rename to app/views/notifier_mailer/planting_reminder.html.haml From fe0157641a3f5ee6a55ceb1eb3b1b33b47bcd637 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:03:31 +1200 Subject: [PATCH 46/72] Removing dependabot config --- .github/dependabot.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index a1b3e6fd7..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: '17:00' - open-pull-requests-limit: 10 -- package-ecosystem: bundler - directory: "/" - schedule: - interval: daily - time: '17:00' - open-pull-requests-limit: 10 - From 552ff6a68029b5129232e904616f0c98e14e55a3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:04:41 +1200 Subject: [PATCH 47/72] Explaning why brakeman is off --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index bbdfa5476..3781db1f1 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -11,7 +11,7 @@ engines: coffeelint: enabled: true brakeman: - enabled: false + enabled: false # codeclimate's brakeman is stuck in rails 5 rules bundler-audit: enabled: true duplication: From 5fec0d4eb90b3d61861f0b306dabf6e45453ae25 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:05:02 +1200 Subject: [PATCH 48/72] Adding ru files to codeclimate --- .codeclimate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index 3781db1f1..310d1bd17 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -23,6 +23,7 @@ engines: ratings: paths: - "**.rb" + - "**.ru" - "**.js" - "**.coffee" - "**.scss" From b1b2661682a94f43aa0fc0e0ea9c51efc1e51c2f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Aug 2020 15:06:33 +1200 Subject: [PATCH 49/72] only run static checks on github --- .github/workflows/ci.yml | 81 ---------------------------------------- 1 file changed, 81 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37afc6e58..636641ec3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,84 +17,3 @@ jobs: - name: Check contributors run: | bundle exec script/check_contributors_md.rb - - test: - runs-on: ubuntu-latest - services: - db: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: growstuff_test - ports: ['5432:5432'] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - steps: - - name: Checkout this repo - uses: actions/checkout@v2 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Setup yarn cache - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install required OS packages - run: | - sudo apt-get -y install libpq-dev google-chrome-stable - - - name: Install NodeJS - uses: actions/setup-node@v2-beta - with: - node-version: '12' - - - name: Install ruby version specified in .ruby-version - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Install gem bundle - run: | - gem install bundler - bundle install - - - name: Install JS dependencies - run: yarn install - - - name: Setup codeclimate - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - - - name: Prepare database for testing - env: - DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test - DEVISE_SECRET_KEY: growstuff - RAILS_ENV: test - run: | - bundle exec rails db:prepare - - - name: Run rspec (report results to Percy.io and codeclimate) - env: - DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test - DEVISE_SECRET_KEY: growstuff - growstuff_ONLINE_SECRET_KEY_BASE: growstuff - APP_DOMAIN_NAME: localhost:3000 - APP_PROTOCOL: http - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - run: | - bundle exec rspec spec - ./cc-test-reporter after-build --exit-code $? From f2b385bd5e451501ebb71c7aa55f840f74b8d180 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 16 Aug 2020 15:31:03 +1200 Subject: [PATCH 50/72] Help view spec find the correct template --- spec/views/crops/index.html.haml_spec.rb | 2 +- spec/views/harvests/index.html.haml_spec.rb | 2 +- spec/views/plantings/index.html.haml_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/views/crops/index.html.haml_spec.rb b/spec/views/crops/index.html.haml_spec.rb index db69f9132..ac57d87f7 100644 --- a/spec/views/crops/index.html.haml_spec.rb +++ b/spec/views/crops/index.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "crops/index" do +describe "crops/index.html.haml" do before do controller.stub(:current_user) { nil } page = 1 diff --git a/spec/views/harvests/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb index 73c2a1fe2..dc2821e77 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "harvests/index" do +describe "harvests/index.html.haml" do before do controller.stub(:current_user) { nil } @member = FactoryBot.create(:member) diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index f2f29f556..3a69a9bc2 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "plantings/index" do +describe "plantings/index.html.haml" do let(:member) { FactoryBot.create(:member) } let(:garden) { FactoryBot.create(:garden, owner: member) } let(:tomato) { FactoryBot.create(:tomato, name: 'tomato') } From 1c9ff5c876533cdc32be9398afe7f6b7113158f3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 16 Aug 2020 15:40:01 +1200 Subject: [PATCH 51/72] removing last mention of cloudmade this company used to produce the leaflet widget, but that staff member moved elsewhere in like 2012 and took the code with them and made it open source. the credit is no longer needed --- app/views/places/_map_attribution.html.haml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/places/_map_attribution.html.haml b/app/views/places/_map_attribution.html.haml index 7637a1ebf..dc002de2c 100644 --- a/app/views/places/_map_attribution.html.haml +++ b/app/views/places/_map_attribution.html.haml @@ -2,4 +2,3 @@ Map data © = link_to "OpenStreetMap", "https://openstreetmap.org" contributors under = link_to "ODbL", "https://www.openstreetmap.org/copyright" -| Imagery © From 5b2355bf42d713b9b1693bfe2e6c6e57276af5eb Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 16 Aug 2020 16:32:03 +1200 Subject: [PATCH 52/72] check out repo --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 636641ec3..111c4027e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ jobs: contributors: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v1 - name: Install ruby version specified in .ruby-version uses: ruby/setup-ruby@v1 with: From ff87a9fa5dce3b26f6c96aa55b21167b061759bc Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 16 Aug 2020 16:36:33 +1200 Subject: [PATCH 53/72] gem updates --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 12306e66e..1b394534e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM bonsai-elasticsearch-rails (7.0.1) elasticsearch-model (< 8) elasticsearch-rails (< 8) - bootstrap (4.5.0) + bootstrap (4.5.2) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) @@ -153,7 +153,7 @@ GEM concord (0.1.5) adamantium (~> 0.2.0) equalizer (~> 0.0.9) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) connection_pool (2.2.3) coveralls (0.7.1) multi_json (~> 1.3) @@ -162,7 +162,7 @@ GEM term-ansicolor thor crass (1.0.6) - csv_shaper (1.3.1) + csv_shaper (1.3.2) activesupport (>= 3.0.0) dalli (2.7.10) database_cleaner (1.8.5) @@ -215,7 +215,7 @@ GEM flickraw (0.9.10) font-awesome-sass (5.13.0) sassc (>= 1.11) - friendly_id (5.3.0) + friendly_id (5.4.0) activerecord (>= 4.0.0) geocoder (1.6.3) gibbon (1.2.1) @@ -492,17 +492,17 @@ GEM rswag-ui (2.3.1) actionpack (>= 3.1, < 7.0) railties (>= 3.1, < 7.0) - rubocop (0.88.0) + rubocop (0.89.1) parallel (~> 1.10) parser (>= 2.7.1.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.7) rexml - rubocop-ast (>= 0.1.0, < 1.0) + rubocop-ast (>= 0.3.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.2.0) - parser (>= 2.7.0.1) + rubocop-ast (0.3.0) + parser (>= 2.7.1.4) rubocop-rails (2.7.1) activesupport (>= 4.2.0) rack (>= 1.1) From 43c1ea21b3957be2cceefa3776059846b2f56873 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 16 Aug 2020 20:07:12 +1200 Subject: [PATCH 54/72] Configure contributor check for github actions --- script/check_contributors_md.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/script/check_contributors_md.rb b/script/check_contributors_md.rb index d0013e78c..317c73fe6 100755 --- a/script/check_contributors_md.rb +++ b/script/check_contributors_md.rb @@ -3,10 +3,12 @@ require "English" -puts "Checking to see if you're in CONTRIBUTORS.md..." +if ENV['CI'] + if ENV['GITHUB_EVENT_NAME'] == 'pull_request' + author = ENV['GITHUB_ACTOR'] + exit 1 unless author -if ENV['TRAVIS'] - if ENV['TRAVIS_PULL_REQUEST'] + elsif ENV['TRAVIS_PULL_REQUEST'] require 'httparty' repo = ENV['TRAVIS_REPO_SLUG'] pr = ENV['TRAVIS_PULL_REQUEST'] @@ -15,7 +17,7 @@ if ENV['TRAVIS'] author = response['user']['login'] if response && response['user'] # Could not determine author - exit unless author + exit 1 unless author else # We're in a Travis branch build; nothing to check exit @@ -34,6 +36,8 @@ end # Escape chars in name, and make case insensitive author_to_search_for = Regexp.new(Regexp.escape(author), Regexp::IGNORECASE) +puts("Checking for #{author} in CONTRIBUTORS.md") + unless File.read('CONTRIBUTORS.md').match?(author_to_search_for) abort %( Thanks for your contribution, #{author}! From e029252c04396684292521dd1eed2392326f15e3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 13:58:05 +1200 Subject: [PATCH 55/72] Only build dev and mainline --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index ba5e4fded..14251f2b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ dist: bionic services: - postgresql - xvfb +branches: + only: + - mainline + - dev cache: bundler: true directories: From a7ab3562983adca6aef7f355e37eb53a7c7c063d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 13:58:29 +1200 Subject: [PATCH 56/72] Updating the setup script --- bin/setup | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/setup b/bin/setup index ac9f62467..a593c68ec 100755 --- a/bin/setup +++ b/bin/setup @@ -19,13 +19,19 @@ FileUtils.chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies - # system('bin/yarn') + puts "Install JavaScript dependencies" + system('bin/yarn') - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' - # end + puts "\n== Copying sample files ==" + unless File.exist?('config/database.yml') + FileUtils.cp 'config/database.yml.example', 'config/database.yml' + end + unless File.exist?('.env') + FileUtils.cp 'env-example', '.env' + end + + puts "\n== Checking for elastic search ==" + system! 'script/check_elasticsearch.sh' puts "\n== Preparing database ==" system! 'bin/rails db:prepare' From 08ecd0ebeea25a992bacc59bba0f643de0573c11 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 13:58:46 +1200 Subject: [PATCH 57/72] Source .env when checking for elastisearch --- script/check_elasticsearch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/check_elasticsearch.sh b/script/check_elasticsearch.sh index 5f1c45a50..b7707afdf 100755 --- a/script/check_elasticsearch.sh +++ b/script/check_elasticsearch.sh @@ -1,5 +1,7 @@ #!/bin/bash +source .env + if [[ -z "$ELASTIC_SEARCH_VERSION" ]]; then echo "ELASTIC_SEARCH_VERSION variable not set" else From 94b481efaf8f1deda754e40d0097bc644f9b4a7c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 14:01:10 +1200 Subject: [PATCH 58/72] Upgrade to rubocop 0.89 on codeclimate --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 310d1bd17..64bfaef0c 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,7 +1,7 @@ engines: rubocop: enabled: true - channel: "rubocop-0-88" + channel: "rubocop-0-89" scss-lint: enabled: true shellcheck: From 2a896f99f5c0193e30394fa9986f5a9f5939f529 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 14:02:26 +1200 Subject: [PATCH 59/72] Upgrade omniauth --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1b394534e..358c6a0f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -364,8 +364,8 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) + omniauth-oauth2 (1.7.0) + oauth2 (~> 1.4) omniauth (~> 1.9) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) From c4b4d382e2e99687a48fdfe3351d6cae3ca30194 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 14:03:08 +1200 Subject: [PATCH 60/72] Upgrade percy-capybara --- Gemfile | 4 ++-- Gemfile.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 561fa6c9b..8a8273e4d 100644 --- a/Gemfile +++ b/Gemfile @@ -112,7 +112,7 @@ gem 'rake', '>= 10.0.0' gem "responders" # allows soft delete. Used for members. -gem 'discard', '~> 1.2' +gem 'discard', '>= 1.2' gem 'xmlrpc' # fixes rake error - can be removed if not needed later @@ -175,7 +175,7 @@ end group :test do gem 'codeclimate-test-reporter', require: false - gem 'percy-capybara', '~> 4.0.0' + gem 'percy-capybara' gem 'rails-controller-testing' gem 'selenium-webdriver' gem 'timecop' diff --git a/Gemfile.lock b/Gemfile.lock index 358c6a0f0..7ae9728a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -374,7 +374,7 @@ GEM parallel (1.19.2) parser (2.7.1.4) ast (~> 2.4.1) - percy-capybara (4.0.2) + percy-capybara (4.2.0) pg (0.21.0) platform-api (3.0.0) heroics (~> 0.1.1) @@ -681,7 +681,7 @@ DEPENDENCIES omniauth-facebook omniauth-flickr (>= 0.0.15) omniauth-twitter - percy-capybara (~> 4.0.0) + percy-capybara pg (< 1.0.0) platform-api puma From 7def8881b4e87adbfc82e58a65cea8bfc7bef418 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Aug 2020 14:04:13 +1200 Subject: [PATCH 61/72] Allow discard gem upgrade --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7ae9728a5..1ce4647cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -644,7 +644,7 @@ DEPENDENCIES dalli database_cleaner devise - discard (~> 1.2) + discard (>= 1.2) dotenv-rails elasticsearch (< 7.0.0) factory_bot_rails From 0108224e4ed4308d0c43df4047be42990c5d1bf4 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 19 Aug 2020 15:46:36 +1200 Subject: [PATCH 62/72] Tests for crop creation --- spec/controllers/crops_controller_spec.rb | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index 826888266..8c4b5cd33 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -70,6 +70,32 @@ describe CropsController do end end + describe 'CREATE' do + let(:crop_params) do + { + crop: { + name: 'aubergine', + en_wikipedia_url: "https://en.wikipedia.org/wiki/Eggplant" + }, + alt_name: {"1": "egg plant", "2": "purple apple"}, + sci_name: {"1": "fancy sci name", "2": ""} + } + end + subject { put :create, params: crop_params } + context 'not logged in' do + it { expect { subject }.not_to change(Crop, :count) } + end + context 'logged in as member' do + it { expect { subject }.not_to change(Crop, :count) } + end + context 'wrangler' do + include_context 'login as wrangler' + it { expect { subject }.to change(Crop, :count).by(1) } + it { expect { subject }.to change(AlternateName, :count).by(2) } + it { expect { subject }.to change(ScientificName, :count).by(1) } + end + end + describe 'DELETE destroy' do subject { delete :destroy, params: { slug: crop.to_param } } From 0b3583e099012f6ea7e1ca7f171d1a0022b0da4d Mon Sep 17 00:00:00 2001 From: Brenda Date: Wed, 19 Aug 2020 15:54:34 +1200 Subject: [PATCH 63/72] DRY crops controller more --- app/controllers/crops_controller.rb | 35 ++++++++++------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index 1e49f8a3e..265103b7b 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -62,9 +62,6 @@ class CropsController < ApplicationController end def show - @crop = Crop.includes( - :scientific_names, :alternate_names, :parent, :varieties - ).find_by!(slug: params[:slug]) respond_to do |format| format.html do @posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page]) @@ -89,7 +86,6 @@ class CropsController < ApplicationController end def edit - @crop = Crop.find_by!(slug: params[:slug]) @crop.alternate_names.build if @crop.alternate_names.blank? @crop.scientific_names.build if @crop.scientific_names.blank? end @@ -110,14 +106,13 @@ class CropsController < ApplicationController end def update - @crop = Crop.find_by!(slug: params[:slug]) - if can?(:wrangle, @crop) @crop.approval_status = 'rejected' if params.fetch("reject", false) @crop.approval_status = 'approved' if params.fetch("approve", false) end @crop.creator = current_member if @crop.approval_status == "pending" + if @crop.update(crop_params) recreate_names('alt_name', 'alternate') recreate_names('sci_name', 'scientific') @@ -152,12 +147,8 @@ class CropsController < ApplicationController end def save_crop_names - params[:alt_name]&.values&.each do |value| - create_name!('alternate', value) unless value.empty? - end - params[:sci_name]&.values&.each do |value| - create_name!('scientific', value) unless value.empty? - end + AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } }) + ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } }) end def notify_wranglers @@ -187,19 +178,18 @@ class CropsController < ApplicationController def crop_params params.require(:crop).permit( - :en_wikipedia_url, - :name, - :parent_id, - :perennial, - :request_notes, - :reason_for_rejection, + :name, :en_wikipedia_url, + :parent_id, :perennial, + :request_notes, :reason_for_rejection, :rejection_notes, - scientific_names_attributes: %i(scientific_name - _destroy - id) + scientific_names_attributes: %i(scientific_name _destroy id) ) end + def names_params(name_type) + params.require(name_type).values&.reject { |n| n.empty? } + end + def filename "Growstuff-Crops-#{Time.zone.now.to_s(:number)}.csv" end @@ -212,8 +202,7 @@ class CropsController < ApplicationController owner: { only: %i(id login_name location latitude longitude) } } }, - scientific_names: { only: [:name] }, - alternate_names: { only: [:name] } + scientific_names: { only: [:name] }, alternate_names: { only: [:name] } } } end From d3eda900003e97f6b326172cd14c4309e780c2c7 Mon Sep 17 00:00:00 2001 From: Brenda Date: Wed, 19 Aug 2020 15:54:41 +1200 Subject: [PATCH 64/72] Adding new cops --- .rubocop.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 2dd325278..fe401f324 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -132,3 +132,31 @@ Rails/ShortI18n: Enabled: true Rails/WhereExists: Enabled: true +Lint/BinaryOperatorWithIdenticalOperands: + Enabled: true +Lint/DuplicateRescueException: + Enabled: true +Lint/EmptyConditionalBody: + Enabled: true +Lint/FloatComparison: + Enabled: true +Lint/MissingSuper: + Enabled: true +Lint/OutOfRangeRegexpRef: + Enabled: true +Lint/SelfAssignment: + Enabled: true +Lint/TopLevelReturnWithArgument: + Enabled: true +Lint/UnreachableLoop: + Enabled: true +Style/ExplicitBlockArgument: + Enabled: true +Style/GlobalStdStream: + Enabled: true +Style/OptionalBooleanParameter: + Enabled: true +Style/SingleArgumentDig: + Enabled: true +Style/StringConcatenation: + Enabled: true From be64224477b735fe28ebacef401ca233e78fe33a Mon Sep 17 00:00:00 2001 From: Brenda Date: Wed, 19 Aug 2020 15:56:09 +1200 Subject: [PATCH 65/72] Cache yarn on travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 14251f2b4..ba7ddb1ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ branches: - dev cache: bundler: true + yarn: true directories: - tmp/cache/assets/test/sprockets addons: From 1179346dd534bcf0684997c2c28633b6b7834956 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 19 Aug 2020 15:56:53 +1200 Subject: [PATCH 66/72] Elastic version in example env --- env-example | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env-example b/env-example index 1a046716c..a7d3ef65e 100644 --- a/env-example +++ b/env-example @@ -61,3 +61,5 @@ GROWSTUFF_FACEBOOK_SECRET="" # set this flag to "true". GROWSTUFF_ELASTICSEARCH="true" GROWSTUFF_EMAIL='noreply@dev.growstuff.org' +ELASTIC_SEARCH_VERSION="7.5.1-amd64" + From 10f72d2b21ebc65f3fd11c176147286fae5cc0d0 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Wed, 26 Aug 2020 00:37:33 +0000 Subject: [PATCH 67/72] Auto corrected by following Format Css Code --- app/assets/stylesheets/_crops.scss | 8 ++-- app/assets/stylesheets/_harvests.scss | 4 +- app/assets/stylesheets/_members.scss | 7 ++-- app/assets/stylesheets/_variables.scss | 43 +++++++++++++--------- app/assets/stylesheets/application.scss | 49 ++++++++++++------------- app/assets/stylesheets/mobile.scss | 10 ++--- app/assets/stylesheets/overrides.scss | 23 +++++------- 7 files changed, 71 insertions(+), 73 deletions(-) diff --git a/app/assets/stylesheets/_crops.scss b/app/assets/stylesheets/_crops.scss index 4649812df..26fd86e8b 100644 --- a/app/assets/stylesheets/_crops.scss +++ b/app/assets/stylesheets/_crops.scss @@ -7,7 +7,7 @@ bottom: 0; color: $white; margin: 0; - opacity: .8; + opacity: 0.8; position: absolute; text-align: center; width: 100%; @@ -22,7 +22,7 @@ h5.crop-sci-name { background-color: $beige; color: $black; - font-size: .7em; + font-size: 0.7em; margin-top: 0; padding-top: 0; } @@ -45,7 +45,7 @@ .planting { .crop-card { height: 100%; - margin: .1em; + margin: 0.1em; min-height: 300px; } @@ -85,7 +85,7 @@ @include media-breakpoint-down(xs) { .index-cards { .crop-thumbnail { - margin: .2em; + margin: 0.2em; width: 30%; } } diff --git a/app/assets/stylesheets/_harvests.scss b/app/assets/stylesheets/_harvests.scss index b8c317ea5..7c248f9ea 100644 --- a/app/assets/stylesheets/_harvests.scss +++ b/app/assets/stylesheets/_harvests.scss @@ -2,7 +2,7 @@ .text { color: $white; margin: 0; - opacity: .8; + opacity: 0.8; position: absolute; text-align: center; top: 30%; @@ -12,7 +12,7 @@ h3, h4, h5 { - margin: 0 + margin: 0; } h3 { diff --git a/app/assets/stylesheets/_members.scss b/app/assets/stylesheets/_members.scss index 84df767ca..da5f4b206 100644 --- a/app/assets/stylesheets/_members.scss +++ b/app/assets/stylesheets/_members.scss @@ -2,7 +2,7 @@ border-radius: 12px; height: 200px; margin: 1em; - padding: .25em; + padding: 0.25em; div { display: inline-block; @@ -11,12 +11,11 @@ } } -.member-thumbnail div~div { +.member-thumbnail div ~ div { padding-left: 1em; width: 15em; } - .member-chip { background-color: lighten($green, 30%); @@ -35,7 +34,7 @@ } .location-not-set { - background-image: image-url('location-not-set.en.png'); + background-image: image-url("location-not-set.en.png"); background-position: center; background-repeat: no-repeat; height: 250px; diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss index b39c7f297..3e1848e19 100644 --- a/app/assets/stylesheets/_variables.scss +++ b/app/assets/stylesheets/_variables.scss @@ -15,30 +15,36 @@ $body-bg: $beige; $text-color: $brown; $link-color: $green; -$default-font: 'Raleway', -"Fira Sans", -Helvetica, -Arial, -sans-serif; +$default-font: "Raleway", "Fira Sans", Helvetica, Arial, sans-serif; -$primary: (color: $green, +$primary: ( + color: $green, dark: darken($green, 20%), - light: lighten($green, 20%)); -$secondary: (color: $blue, + light: lighten($green, 20%), +); +$secondary: ( + color: $blue, dark: darken($blue, 20%), - light: lighten($blue, 20%)); -$success: (color: $green, + light: lighten($blue, 20%), +); +$success: ( + color: $green, dark: darken($green, 20%), - light: lighten($green, 20%)); -$danger: (color: $red, + light: lighten($green, 20%), +); +$danger: ( + color: $red, dark: darken($red, 20%), - light: lighten($red, 20%)); -$dark: (color: $brown, + light: lighten($red, 20%), +); +$dark: ( + color: $brown, dark: darken($brown, 20%), - light: lighten($brown, 20%)); + light: lighten($brown, 20%), +); - -$grid-breakpoints: ( // Extra small screen / phone +$grid-breakpoints: ( + // Extra small screen / phone xs: 0, // Small screen / phone sm: 576px, @@ -47,7 +53,8 @@ $grid-breakpoints: ( // Extra small screen / phone // Large screen / desktop lg: 1200px, // Extra large screen / wide desktop - xl: 1800px); + xl: 1800px +); // Nav bar $navbar-default-bg: $brown; diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6c7d7ffe5..1825ff9fb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,33 +1,32 @@ // Import original variables so they can be used in overrides -@import 'variables'; -@import 'material'; - -@import 'jquery-ui/autocomplete'; -@import 'bootstrap-datepicker'; -@import 'leaflet'; -@import 'leaflet.markercluster'; +@import "variables"; +@import "material"; +@import "jquery-ui/autocomplete"; +@import "bootstrap-datepicker"; +@import "leaflet"; +@import "leaflet.markercluster"; // Font Awesome -@import 'font-awesome-sprockets'; -@import 'font-awesome'; -@import 'material_icons'; -@import 'rails_bootstrap_forms'; +@import "font-awesome-sprockets"; +@import "font-awesome"; +@import "material_icons"; +@import "rails_bootstrap_forms"; -@import 'overrides'; -@import 'mobile'; +@import "overrides"; +@import "mobile"; -@import 'crops'; -@import 'harvests'; -@import 'likes'; -@import 'members'; -@import 'notifications'; -@import 'plantings'; -@import 'photos'; -@import 'posts'; -@import 'seeds'; +@import "crops"; +@import "harvests"; +@import "likes"; +@import "members"; +@import "notifications"; +@import "plantings"; +@import "photos"; +@import "posts"; +@import "seeds"; -@import 'predictions'; -@import 'homepage'; -@import 'maps'; +@import "predictions"; +@import "homepage"; +@import "maps"; diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss index 760e5eaa7..25a03fa84 100644 --- a/app/assets/stylesheets/mobile.scss +++ b/app/assets/stylesheets/mobile.scss @@ -1,7 +1,6 @@ // Overrides applying only to mobile view. This must be at the end of the overrides file. // Extra small devices (portrait phones, less than 576px) @include media-breakpoint-down(md) { - .container { margin: 2px; padding: 0; @@ -11,7 +10,7 @@ width: 100%; } - .navbar .nav>li { + .navbar .nav > li { display: block; } @@ -33,11 +32,10 @@ } .site-name:after { - content: ''; + content: ""; display: inline-block; width: 100%; } - } h1 { @@ -66,14 +64,13 @@ height: 300px; } - section .btn { width: 100%; } .index-cards { .card { - margin: .2em; + margin: 0.2em; width: 48%; // Shrink title to fit more on page @@ -87,7 +84,6 @@ object-fit: cover; width: 100%; } - } } } diff --git a/app/assets/stylesheets/overrides.scss b/app/assets/stylesheets/overrides.scss index edf152e83..1158d5268 100755 --- a/app/assets/stylesheets/overrides.scss +++ b/app/assets/stylesheets/overrides.scss @@ -10,9 +10,9 @@ body { .navbar-brand { .site-name { - font-family: 'Modak', cursive; + font-family: "Modak", cursive; font-size: 3em; - margin: .3em; + margin: 0.3em; } img { @@ -46,7 +46,6 @@ body { font-size: 5em; } - .ellipsis { overflow: hidden; text-overflow: ellipsis; @@ -82,9 +81,8 @@ h3 { font-size: 120%; } - section { - margin: .5em 0 0; + margin: 0.5em 0 0; padding: 0 0 1em; h2 { @@ -92,7 +90,7 @@ section { box-shadow: 1px 1px 1px 1px darken($beige, 20%); color: $white; font-weight: normal; - padding: .2em; + padding: 0.2em; a { color: $white; @@ -117,7 +115,7 @@ section { .card { background: $white; border-radius: 5%; - margin: .5em .5em .5em 0; + margin: 0.5em 0.5em 0.5em 0; width: 200px; .img-card { @@ -232,7 +230,6 @@ ul.associations { // footer footer { - #footer1, #footer2, #footer3 { @@ -370,7 +367,7 @@ ul.thumbnail-buttons { } .info { - padding: .5em; + padding: 0.5em; text-align: center; } } @@ -386,7 +383,7 @@ ul.thumbnail-buttons { display: inline-block; height: 30px; line-height: 30px; - margin: .2em; + margin: 0.2em; padding: 0 25px; a { @@ -411,14 +408,14 @@ ul.thumbnail-buttons { .progress-fade::before { background: $beige; bottom: 0; - content: ''; + content: ""; display: block; left: 0; - opacity: .7; + opacity: 0.7; position: absolute; right: 0; top: 0; - transition: background .3s linear; + transition: background 0.3s linear; } .progress-fade:hover::before { From aac7d7109fdcc6c7a432c7f097e60b446e65ac00 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 04:23:48 +0000 Subject: [PATCH 68/72] Bump rubocop-rspec from 1.42.0 to 1.43.2 Bumps [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) from 1.42.0 to 1.43.2. - [Release notes](https://github.com/rubocop-hq/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop-rspec/compare/v1.42.0...v1.43.2) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1ce4647cd..24108e9fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -507,8 +507,8 @@ GEM activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 0.87.0) - rubocop-rspec (1.42.0) - rubocop (>= 0.87.0) + rubocop-rspec (1.43.2) + rubocop (~> 0.87) ruby-progressbar (1.10.1) ruby-units (2.3.1) ruby-vips (2.0.17) From 2b8286a5d6d112a5dc50aabe2c27d0ac3b77ba4a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 20:00:03 +0000 Subject: [PATCH 69/72] Bump oj from 3.10.8 to 3.10.12 Bumps [oj](https://github.com/ohler55/oj) from 3.10.8 to 3.10.12. - [Release notes](https://github.com/ohler55/oj/releases) - [Changelog](https://github.com/ohler55/oj/blob/develop/CHANGELOG.md) - [Commits](https://github.com/ohler55/oj/compare/v3.10.8...v3.10.12) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 24108e9fb..233e3d889 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,6 +85,7 @@ GEM coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) + bigdecimal (2.0.0) bluecloth (2.2.0) bonsai-elasticsearch-rails (7.0.1) elasticsearch-model (< 8) @@ -352,7 +353,8 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - oj (3.10.8) + oj (3.10.12) + bigdecimal (>= 1.0, < 3) omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) From ed81808f5878d215990dccc94643075c1c653acb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 23:35:20 +0000 Subject: [PATCH 70/72] Bump scout_apm from 2.6.8 to 2.6.9 Bumps [scout_apm](https://github.com/scoutapp/scout_apm_ruby) from 2.6.8 to 2.6.9. - [Release notes](https://github.com/scoutapp/scout_apm_ruby/releases) - [Changelog](https://github.com/scoutapp/scout_apm_ruby/blob/master/CHANGELOG.markdown) - [Commits](https://github.com/scoutapp/scout_apm_ruby/compare/v2.6.8...v2.6.9) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 233e3d889..53d06f9fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -533,7 +533,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - scout_apm (2.6.8) + scout_apm (2.6.9) parser searchkick (4.4.1) activemodel (>= 5) From ddf366bd3c652122107fd994a3d0e9908401b17e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2020 07:16:03 +0000 Subject: [PATCH 71/72] Bump loofah from 2.6.0 to 2.7.0 Bumps [loofah](https://github.com/flavorjones/loofah) from 2.6.0 to 2.7.0. - [Release notes](https://github.com/flavorjones/loofah/releases) - [Changelog](https://github.com/flavorjones/loofah/blob/master/CHANGELOG.md) - [Commits](https://github.com/flavorjones/loofah/compare/v2.6.0...v2.7.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 53d06f9fc..e9a51433c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -311,7 +311,7 @@ GEM listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.6.0) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) From 0e39b1ab4eb78d0067bf4637c9ebda18fb1860fd Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2020 09:13:50 +0000 Subject: [PATCH 72/72] Bump omniauth-facebook from 6.0.0 to 7.0.0 Bumps [omniauth-facebook](https://github.com/mkdynamic/omniauth-facebook) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/mkdynamic/omniauth-facebook/releases) - [Changelog](https://github.com/simi/omniauth-facebook/blob/master/CHANGELOG.md) - [Commits](https://github.com/mkdynamic/omniauth-facebook/compare/v6.0.0...v7.0.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e9a51433c..b38063760 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -298,7 +298,7 @@ GEM concurrent-ruby railties (>= 4.1) jsonapi-swagger (0.8.0) - jwt (2.2.1) + jwt (2.2.2) kgio (2.11.3) kramdown (2.3.0) rexml @@ -358,7 +358,7 @@ GEM omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-facebook (6.0.0) + omniauth-facebook (7.0.0) omniauth-oauth2 (~> 1.2) omniauth-flickr (0.0.20) multi_json (~> 1.12)