diff --git a/.ruby-version b/.ruby-version index 6ebad1488..ff365e06b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 \ No newline at end of file +3.1.3 diff --git a/Gemfile.lock b/Gemfile.lock index 1bdcda7fe..e0abee70a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -751,7 +751,7 @@ DEPENDENCIES xmlrpc RUBY VERSION - ruby 3.1.2p20 + ruby 3.1.3p185 BUNDLED WITH 2.3.11 diff --git a/README.md b/README.md index bb9ab076a..ff17178d2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ encourage participation from people of all backgrounds and skill levels. * [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're working on, known bugs, etc) * [![Gitter](https://badges.gitter.im/Growstuff/growstuff.svg)](https://gitter.im/Growstuff/growstuff?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org)) +* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc.) ## For coders @@ -29,7 +29,6 @@ frontend features. We welcome contributions -- see [CONTRIBUTING](CONTRIBUTING.md) for details. * To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide). -* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers. * You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API). ## For designers, writers, researchers, data wranglers, and other contributors diff --git a/app/assets/javascripts/cropmap.js.erb b/app/assets/javascripts/cropmap.js.erb index 756530666..1366a461d 100644 --- a/app/assets/javascripts/cropmap.js.erb +++ b/app/assets/javascripts/cropmap.js.erb @@ -1,10 +1,6 @@ function showCropMap(cropmap) { - var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>"; - var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>"; - var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token; - - L.tileLayer(mapbox_base_url, { - attribution: 'Map data © OpenStreetMap contributors under ODbL | Map imagery © Mapbox', + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', maxZoom: 18 }).addTo(cropmap); var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 20 }); diff --git a/app/assets/javascripts/members.js.erb b/app/assets/javascripts/members.js.erb index 42fafe6b5..ab00a33b2 100644 --- a/app/assets/javascripts/members.js.erb +++ b/app/assets/javascripts/members.js.erb @@ -1,10 +1,4 @@ if (document.getElementById("membermap") !== null) { - var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>"; - var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>"; - var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token; - - L.Icon.Default.imagePath = '/assets' - L.Icon.Default.imagePath = '/assets'; var default_marker_icon = L.icon({ @@ -18,8 +12,8 @@ if (document.getElementById("membermap") !== null) { if (member.latitude && member.longitude) { var membermap = L.map('membermap').setView([member.latitude, member.longitude], 4); - L.tileLayer(mapbox_base_url, { - attribution: 'Map data © OpenStreetMap contributors under ODbL | Map imagery © Mapbox', + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', maxZoom: 18 }).addTo(membermap); var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude), diff --git a/app/assets/javascripts/places.js.erb b/app/assets/javascripts/places.js.erb index b5917f614..93e5e9538 100644 --- a/app/assets/javascripts/places.js.erb +++ b/app/assets/javascripts/places.js.erb @@ -1,8 +1,5 @@ if (document.getElementById("placesmap") !== null) { var places_base_path = "/places"; - var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>"; - var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>"; - var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token; var nominatim_base_url = 'https://nominatim.openstreetmap.org/search/'; var nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Rails.application.config.user_agent_email %>"; @@ -31,8 +28,8 @@ if (document.getElementById("placesmap") !== null) { } function showMap(placesmap) { - L.tileLayer(mapbox_base_url, { - attribution: 'Map data © OpenStreetMap contributors under ODbL | Map imagery © Mapbox', + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', maxZoom: 18 }).addTo(placesmap); diff --git a/app/views/crops/_form.html.haml b/app/views/crops/_form.html.haml index 2ef58f243..dcf451e6a 100644 --- a/app/views/crops/_form.html.haml +++ b/app/views/crops/_form.html.haml @@ -19,7 +19,7 @@ %p %span.help-block For detailed crop wrangling guidelines, please consult the - = link_to "crop wrangling guide", "http://wiki.growstuff.org/index.php/Crop_wrangling" + = link_to "crop wrangling guide", "https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling" on the Growstuff wiki. -# Everyone (wranglers and requesters) sees the basic info section diff --git a/app/views/members/_member.haml b/app/views/members/_member.haml index 5f6b2ce7e..44f088f38 100644 --- a/app/views/members/_member.haml +++ b/app/views/members/_member.haml @@ -1,19 +1,18 @@ - cache member do .card.card-double .card-body - .row - .col-12.col-md-6 - = render "members/avatar", member: member - .col-12.col-md-6 - %h4.login-name= link_to member, member - = link_to "view all #{member}'s gardens", member_gardens_path(member) - %p - %small - Joined - = distance_of_time_in_words(member.created_at, Time.zone.now) - ago. - - if member.location.present? - = link_to member.location, place_path(member.location) + %h4.login-name= link_to member, member + %div + = render "members/avatar", member: member + %div + = link_to "view all #{member}'s gardens", member_gardens_path(member) + %p + %small + Joined + = distance_of_time_in_words(member.created_at, Time.zone.now) + ago. + - if member.location.present? + = link_to member.location, place_path(member.location) .card-footer %ul.nav.nav-justified.small %li.nav-item.border-right diff --git a/app/views/places/_search_form.html.haml b/app/views/places/_search_form.html.haml index 57b1a1b6f..bb4cd68ea 100644 --- a/app/views/places/_search_form.html.haml +++ b/app/views/places/_search_form.html.haml @@ -1,6 +1,6 @@ %form.form-inline{ action: search_places_path, method: :get, role: 'form' } .form-group = label_tag :new_place, "Change location:", class: 'sr-only' - = text_field_tag :new_place, '', class: 'form-control', placeholder: "New location..." + = text_field_tag :new_place, '', class: 'form-control', placeholder: "Search for city, suburb or state..." = submit_tag "Search", class: 'btn btn-primary', id: "search_button" %br/ diff --git a/app/views/posts/_summary.html.haml b/app/views/posts/_summary.html.haml index 7b0c59c78..41da1ec4f 100644 --- a/app/views/posts/_summary.html.haml +++ b/app/views/posts/_summary.html.haml @@ -2,10 +2,10 @@ - unless posts.empty? %table.table.table-striped %tr - %th Subject - %th.hidden-xs Posted by - %th Most recent activity - %th.hidden-xs Comments + %th.col-6 Subject + %th.col-2.hidden-xs Posted by + %th.col-2 Most recent activity + %th.col-2.hidden-xs Comments - posts.recently_active[0..howmany - 1].each do |post| - cache post do diff --git a/config/application.rb b/config/application.rb index 8ef5a9410..ef75d9372 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,6 +23,8 @@ module Growstuff config.time_zone = 'UTC' config.active_record.default_timezone = :local + config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone] + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}')] I18n.default_locale = :en diff --git a/config/environments/development.rb b/config/environments/development.rb index caaf7fcd9..0368822e9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -69,11 +69,6 @@ Rails.application.configure do config.host = 'localhost:3000' config.analytics_code = '' - # this config variable cannot be put in application.yml as it is needed - # by the assets pipeline, which doesn't have access to ENV. - config.mapbox_map_id = 'growstuff.i3n2il6a' - config.mapbox_access_token = 'pk.eyJ1IjoiZ3Jvd3N0dWZmIiwiYSI6IkdxMkx4alUifQ.n0igaBsw97s14zMa0lwKCA' - config.action_controller.action_on_unpermitted_parameters = :raise config.active_job.queue_adapter = :sidekiq diff --git a/config/environments/production.rb b/config/environments/production.rb index 01f901f4d..d16a4af0d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -109,11 +109,6 @@ Rails.application.configure do eos - # this config variable cannot be put in application.yml as it is needed - # by the assets pipeline, which doesn't have access to ENV. - config.mapbox_map_id = ENV['GROWSTUFF_MAPBOX_MAP_ID'] - config.mapbox_access_token = ENV['GROWSTUFF_MAPBOX_ACCESS_TOKEN'] - config.active_job.queue_adapter = :sidekiq # Use a different logger for distributed setups. # require 'syslog/logger' diff --git a/db/migrate/20191119020643_upgrade_cms.rb b/db/migrate/20191119020643_upgrade_cms.rb index 8256e9103..0c6ca4d5d 100644 --- a/db/migrate/20191119020643_upgrade_cms.rb +++ b/db/migrate/20191119020643_upgrade_cms.rb @@ -23,9 +23,9 @@ class UpgradeCms < ActiveRecord::Migration[5.2] t.string :locale, null: false t.integer :page_id, null: false t.integer :layout_id - t.string :label, null: false - t.text :content_cache, limit: limit - t.boolean :is_published, null: false, default: true + t.string :label, null: false + t.text(:content_cache, limit:) + t.boolean :is_published, null: false, default: true t.timestamps t.index [:page_id] diff --git a/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb b/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb new file mode 100644 index 000000000..ed5c1d300 --- /dev/null +++ b/db/migrate/20230313015323_create_active_storage_tables.active_storage.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[5.2] + def change + # Use Active Record's configured type for primary and foreign keys + primary_key_type, foreign_key_type = primary_and_foreign_key_types + + create_table :active_storage_blobs, id: primary_key_type do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.string :service_name, null: false + t.bigint :byte_size, null: false + t.string :checksum + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [:key], unique: true + end + + create_table :active_storage_attachments, id: primary_key_type do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type + t.references :blob, null: false, type: foreign_key_type + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index %i(record_type record_id name blob_id), name: :index_active_storage_attachments_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + + create_table :active_storage_variant_records, id: primary_key_type do |t| + t.belongs_to :blob, null: false, index: false, type: foreign_key_type + t.string :variation_digest, null: false + + t.index %i(blob_id variation_digest), name: :index_active_storage_variant_records_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + + def primary_and_foreign_key_types + config = Rails.configuration.generators + setting = config.options[config.orm][:primary_key_type] + primary_key_type = setting || :primary_key + foreign_key_type = setting || :bigint + [primary_key_type, foreign_key_type] + end +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 03330a79c..37bf1aee3 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -103,7 +103,6 @@ RSpec.configure do |config| if page.driver.browser.respond_to?(:url_blacklist) page.driver.browser.url_blacklist = [ 'gravatar.com', - 'mapbox.com', 'okfn.org', 'googlecode.com' ] diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index 95dfc5db0..eeee051b9 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -16,6 +16,6 @@ describe "crops/new" do end it "shows a link to crop wrangling guidelines" do - assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide" + assert_select "a[href^='https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling']", "crop wrangling guide" end end