From: Tom Hughes Date: Wed, 14 Jun 2023 16:41:30 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/3975' X-Git-Tag: live~2044 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/30a01fb7f9dedc757a27f9bf97e3d720f4530508?hp=2a62e368cc15e2b40e66d3d37eaf3778dbcddee0 Merge remote-tracking branch 'upstream/pull/3975' --- diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index acc19b8c0..74d03b31c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,7 +8,7 @@ concurrency: jobs: test: name: Docker - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout source uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8dd3d69a5..e762df445 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,12 +6,12 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true env: - os: ubuntu-20.04 - ruby: '2.7' + os: ubuntu-22.04 + ruby: '3.0' jobs: rubocop: name: RuboCop - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: run: bundle exec rubocop --format fuubar erblint: name: ERB Lint - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code uses: actions/checkout@v3 @@ -37,7 +37,7 @@ jobs: run: bundle exec erblint . eslint: name: ESLint - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code uses: actions/checkout@v3 @@ -61,7 +61,7 @@ jobs: run: bundle exec rails eslint brakeman: name: Brakeman - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code uses: actions/checkout@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aa8edff12..d4e5dd346 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: ubuntu: [20.04, 22.04] - ruby: ['2.7', '3.0', '3.1'] + ruby: ['3.0', '3.1'] runs-on: ubuntu-${{ matrix.ubuntu }} env: RAILS_ENV: test @@ -60,10 +60,11 @@ jobs: - name: Run tests run: bundle exec rails test:all - name: Report completion to Coveralls - uses: coverallsapp/github-action@v1.2.4 + uses: coverallsapp/github-action@v2.2.0 with: github-token: ${{ secrets.github_token }} flag-name: ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }} + format: lcov parallel: true finish: name: Finalise @@ -71,7 +72,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Report completion to Coveralls - uses: coverallsapp/github-action@v1.2.4 + uses: coverallsapp/github-action@v2.2.0 with: github-token: ${{ secrets.github_token }} parallel-finished: true diff --git a/.gitignore b/.gitignore index 75e9eb59e..e5866532e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *~ .DS_Store +.bundle/config .idea .ruby-gemset .ruby-version diff --git a/.rubocop.yml b/.rubocop.yml index cfa31cc04..dc2a33a35 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,13 +2,14 @@ inherit_from: .rubocop_todo.yml require: - rubocop-capybara + - rubocop-factory_bot - rubocop-minitest - rubocop-performance - rubocop-rails - rubocop-rake AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 NewCops: enable Exclude: - 'vendor/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d763c6d46..527c79354 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-01-03 19:11:30 UTC using RuboCop version 1.42.0. +# on 2023-04-11 16:47:05 UTC using RuboCop version 1.50.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -14,15 +14,15 @@ require: - rubocop-rails - rubocop-rake -# Offense count: 556 +# Offense count: 557 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 248 # Offense count: 29 -# This cop supports safe autocorrection (--autocorrect). +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: Exclude: @@ -42,13 +42,13 @@ Lint/AssignmentInCondition: - 'lib/osm.rb' - 'script/deliver-message' -# Offense count: 681 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes. +# Offense count: 680 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 189 # Offense count: 73 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. # AllowedMethods: refine Metrics/BlockLength: Max: 71 @@ -58,18 +58,18 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 5 -# Offense count: 25 +# Offense count: 26 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 316 + Max: 285 -# Offense count: 60 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +# Offense count: 59 +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 26 -# Offense count: 755 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Offense count: 753 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 179 @@ -78,17 +78,17 @@ Metrics/MethodLength: Metrics/ParameterLists: Max: 6 -# Offense count: 57 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +# Offense count: 56 +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 27 -# Offense count: 2513 +# Offense count: 2394 # This cop supports safe autocorrection (--autocorrect). Minitest/EmptyLineBeforeAssertionMethods: Enabled: false -# Offense count: 564 +# Offense count: 565 Minitest/MultipleAssertions: Max: 54 @@ -172,6 +172,17 @@ Rails/OutputSafety: - 'lib/rich_text.rb' - 'test/helpers/application_helper_test.rb' +# Offense count: 16 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ThreeStateBooleanColumn: + Exclude: + - 'db/migrate/001_create_osm_db.rb' + - 'db/migrate/006_tile_nodes.rb' + - 'db/migrate/007_add_relations.rb' + - 'db/migrate/054_refactor_map_bug_tables.rb' + - 'db/migrate/20140507110937_create_changeset_comments.rb' + # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). Rake/Desc: @@ -181,7 +192,7 @@ Rake/Desc: - 'lib/tasks/subscribe_diary_authors.rake' - 'lib/tasks/subscribe_old_changesets.rake' -# Offense count: 631 +# Offense count: 632 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never @@ -193,10 +204,3 @@ Style/FrozenStringLiteralComment: # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. Style/NumericLiterals: MinDigits: 15 - -# Offense count: 110 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: . -# SupportedOperators: *, +, &, |, ^ -Style/YodaExpression: - Enabled: false diff --git a/DOCKER.md b/DOCKER.md index 2df50bea9..bddb9695b 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -5,7 +5,7 @@ These instructions are designed for setting up `openstreetmap-website` for devel - [Install Docker](https://docs.docker.com/install/) - [Install Docker Compose](https://docs.docker.com/compose/install/) -**Windows users: You must enable symlinks before cloning the repository.** This repository uses symbolic links that are not enabled by default on Windows. To enable them, [turn on Developer Mode](https://windowsreport.com/windows-11-developer-mode/) on Windows and run `git config --global core.symlinks true` to enable symlinks in Git. See [this StackOverflow question](https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows) for more information. +**Windows users: You must enable git symlinks before cloning the repository.** This repository uses symbolic links that are not enabled by default on Windows git. To enable them, [turn on Developer Mode](https://windowsreport.com/windows-11-developer-mode/) on Windows and run `git config --global core.symlinks true` to enable symlinks in Git. See [this StackOverflow question](https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows) for more information. The first step is to fork/clone the repo to your local machine: diff --git a/Dockerfile b/Dockerfile index 0bd5947be..f3c56e161 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive @@ -9,7 +9,7 @@ RUN apt-get update \ curl \ default-jre-headless \ file \ - firefox-geckodriver \ + gpg-agent \ libarchive-dev \ libffi-dev \ libgd-dev \ @@ -19,13 +19,21 @@ RUN apt-get update \ libxml2-dev \ libxslt1-dev \ locales \ - nodejs \ postgresql-client \ - ruby2.7 \ - ruby2.7-dev \ + ruby \ + ruby-dev \ + ruby-bundler \ + software-properties-common \ tzdata \ unzip \ - yarnpkg \ + nodejs \ + npm \ + && npm install --global yarn \ + # We can't use snap packages for firefox inside a container, so we need to get firefox+geckodriver elsewhere + && add-apt-repository -y ppa:mozillateam/ppa \ + && echo "Package: *\nPin: release o=LP-PPA-mozillateam\nPin-Priority: 1001" > /etc/apt/preferences.d/mozilla-firefox \ + && apt-get install --no-install-recommends -y \ + firefox-geckodriver \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -41,8 +49,7 @@ WORKDIR /app # Install Ruby packages ADD Gemfile Gemfile.lock /app/ -RUN gem install bundler \ - && bundle install +RUN bundle install # Install NodeJS packages using yarn ADD package.json yarn.lock /app/ diff --git a/Gemfile b/Gemfile index c25240f9f..39ffed860 100644 --- a/Gemfile +++ b/Gemfile @@ -153,6 +153,7 @@ group :test do gem "rails-controller-testing" gem "rubocop" gem "rubocop-capybara" + gem "rubocop-factory_bot" gem "rubocop-minitest" gem "rubocop-performance" gem "rubocop-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 1bdac0de6..a0155a22c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,78 +3,78 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.0.5) + actionpack (= 7.0.5) + activesupport (= 7.0.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailbox (7.0.5) + actionpack (= 7.0.5) + activejob (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.0.5) + actionpack (= 7.0.5) + actionview (= 7.0.5) + activejob (= 7.0.5) + activesupport (= 7.0.5) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.5) + actionview (= 7.0.5) + activesupport (= 7.0.5) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actionpack-page_caching (1.2.4) actionpack (>= 4.0.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actiontext (7.0.5) + actionpack (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.0.5) + activesupport (= 7.0.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + activejob (7.0.5) + activesupport (= 7.0.5) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.0.5) + activesupport (= 7.0.5) + activerecord (7.0.5) + activemodel (= 7.0.5) + activesupport (= 7.0.5) activerecord-import (1.4.1) activerecord (>= 4.2) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activestorage (7.0.5) + actionpack (= 7.0.5) + activejob (= 7.0.5) + activerecord (= 7.0.5) + activesupport (= 7.0.5) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) annotate (3.2.0) activerecord (>= 3.2, < 8.0) @@ -86,25 +86,25 @@ GEM autoprefixer-rails (10.4.13.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.726.0) - aws-sdk-core (3.170.0) + aws-partitions (1.778.0) + aws-sdk-core (3.174.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.63.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.66.0) + aws-sdk-core (~> 3, >= 3.174.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.119.1) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.123.2) + aws-sdk-core (~> 3, >= 3.174.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) - better_errors (2.9.1) - coderay (>= 1.0.0) + better_errors (2.10.0) erubi (>= 1.0.0) rack (>= 0.9.0) + rouge (>= 1.0.0) better_html (2.0.1) actionview (>= 6.0) activesupport (>= 6.0) @@ -120,10 +120,10 @@ GEM autoprefixer-rails (>= 9.1.0) popper_js (>= 2.9.3, < 3) sassc-rails (>= 2.0.0) - bootstrap_form (5.1.0) - actionpack (>= 5.2) - activemodel (>= 5.2) - brakeman (5.4.1) + bootstrap_form (5.2.2) + actionpack (>= 6.0) + activemodel (>= 6.0) + brakeman (6.0.0) brotli (0.4.0) browser (5.3.1) builder (3.2.4) @@ -132,7 +132,7 @@ GEM cancancan (3.5.0) canonical-rails (0.2.14) rails (>= 4.1, <= 7.1) - capybara (3.38.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -141,14 +141,13 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - coderay (1.1.3) composite_primary_keys (14.0.6) activerecord (~> 7.0.2) concurrent-ruby (1.2.2) - config (4.1.0) + config (4.2.0) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) - connection_pool (2.3.0) + connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) @@ -162,7 +161,7 @@ GEM activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) docile (1.4.0) - doorkeeper (5.6.5) + doorkeeper (5.6.6) railties (>= 5) doorkeeper-i18n (5.2.6) doorkeeper (>= 5.2) @@ -178,12 +177,12 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.0) + dry-schema (1.13.2) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (>= 1.5, < 2) + dry-logic (>= 1.4, < 2) dry-types (>= 1.7, < 2) zeitwerk (~> 2.6) dry-types (1.7.1) @@ -198,7 +197,7 @@ GEM dry-initializer (~> 3.0) dry-schema (>= 1.12, < 2) zeitwerk (~> 2.6) - erb_lint (0.3.1) + erb_lint (0.4.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) @@ -207,13 +206,13 @@ GEM smart_properties erubi (1.12.0) execjs (2.8.1) - exifr (1.3.10) + exifr (1.4.0) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (2.7.4) + faraday (2.7.6) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) @@ -235,7 +234,7 @@ GEM highline (2.1.0) htmlentities (4.3.4) http_accept_language (2.1.1) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) i18n-js (3.9.2) i18n (>= 0.6.6) @@ -263,7 +262,7 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - image_size (3.2.0) + image_size (3.3.0) in_threads (1.6.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -274,20 +273,20 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.6.3) - jwt (2.7.0) + jwt (2.7.1) kgio (2.11.4) kramdown (2.4.0) rexml - libxml-ruby (4.0.0) + libxml-ruby (4.1.1) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logstasher (2.1.5) activesupport (>= 5.2) request_store - loofah (2.19.1) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -299,12 +298,12 @@ GEM method_source (1.0.0) mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.8.1) + mini_portile2 (2.8.2) minitest (5.18.0) - msgpack (1.6.1) + msgpack (1.7.1) multi_json (1.15.0) multi_xml (0.6.0) - net-imap (0.3.4) + net-imap (0.3.6) date net-protocol net-pop (0.1.2) @@ -313,9 +312,9 @@ GEM timeout net-smtp (0.3.3) net-protocol - nio4r (2.5.8) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + nio4r (2.5.9) + nokogiri (1.15.2) + mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth (0.4.7) oauth-plugin (0.5.1) @@ -363,43 +362,44 @@ GEM multi_json (~> 1.12) omniauth-oauth2 (~> 1.4) openstreetmap-deadlock_retry (1.3.1) - parallel (1.22.1) - parser (3.2.1.1) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) - pg (1.4.6) - popper_js (2.11.6) + racc + pg (1.5.3) + popper_js (2.11.7) progress (3.6.0) public_suffix (5.0.1) puma (5.6.5) nio4r (~> 2.0) quad_tile (1.0.1) r2 (0.2.7) - racc (1.6.2) - rack (2.2.6.4) - rack-cors (2.0.0) + racc (1.7.0) + rack (2.2.7) + rack-cors (2.0.1) rack (>= 2.0.0) rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) - rack-protection (3.0.5) + rack-protection (3.0.6) rack rack-test (2.1.0) rack (>= 1.3) rack-uri_sanitizer (0.0.2) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails (7.0.5) + actioncable (= 7.0.5) + actionmailbox (= 7.0.5) + actionmailer (= 7.0.5) + actionpack (= 7.0.5) + actiontext (= 7.0.5) + actionview (= 7.0.5) + activejob (= 7.0.5) + activemodel (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) bundler (>= 1.15.0) - railties (= 7.0.4.3) + railties (= 7.0.5) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -407,14 +407,15 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + railties (7.0.5) + actionpack (= 7.0.5) + activesupport (= 7.0.5) method_source rake (>= 12.2) thor (~> 1.0) @@ -424,32 +425,35 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.7.0) + regexp_parser (2.8.1) request_store (1.5.1) rack (>= 1.4) rexml (3.2.5) rinku (2.0.6) rotp (6.2.2) - rubocop (1.48.1) + rouge (4.1.2) + rubocop (1.52.1) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.26.0, < 2.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.27.0) + rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-capybara (2.17.1) + rubocop-capybara (2.18.0) rubocop (~> 1.41) - rubocop-minitest (0.29.0) + rubocop-factory_bot (2.23.1) + rubocop (~> 1.33) + rubocop-minitest (0.31.0) rubocop (>= 1.39, < 2.0) - rubocop-performance (1.16.0) + rubocop-performance (1.18.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.18.0) + rubocop-rails (2.19.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -473,7 +477,7 @@ GEM sprockets-rails tilt secure_headers (6.5.0) - selenium-webdriver (4.8.1) + selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -502,10 +506,10 @@ GEM activerecord (>= 5.2) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.1.14) + terser (1.1.16) execjs (>= 0.3.0, < 3) - thor (1.2.1) - tilt (2.1.0) + thor (1.2.2) + tilt (2.2.0) timeout (0.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -513,7 +517,7 @@ GEM validates_email_format_of (1.7.2) i18n vendorer (0.2.0) - version_gem (1.1.1) + version_gem (1.1.3) webmock (3.18.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -524,7 +528,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.7) + zeitwerk (2.6.8) PLATFORMS ruby @@ -603,6 +607,7 @@ DEPENDENCIES rotp rubocop rubocop-capybara + rubocop-factory_bot rubocop-minitest rubocop-performance rubocop-rails diff --git a/INSTALL.md b/INSTALL.md index 9ea442476..74c736f4c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -9,7 +9,7 @@ are two alternatives which make it easier to get a consistent development enviro * **Vagrant** This installs the software into a virtual machine. For Vagrant instructions see [VAGRANT.md](VAGRANT.md). * **Docker** This installs the software using containerization. For Docker instructions see [DOCKER.md](DOCKER.md). -These instructions are based on Ubuntu 20.04 LTS, which is the platform used by the OSMF servers. +These instructions are based on Ubuntu 22.04 LTS, which is the platform used by the OSMF servers. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and MacOSX We don't recommend attempting to develop or deploy this software on Windows. Some Ruby gems may not be supported. If you need to use Windows the easiest solutions in order are [Docker](DOCKER.md), [Vagrant](VAGRANT.md), and Ubuntu in a virtual machine. @@ -22,21 +22,21 @@ of packages required before you can get the various gems installed. ## Minimum requirements -* Ruby 2.7+ +* Ruby 3.0+ * PostgreSQL 9.1+ * Bundler (see note below about [developer Ruby setup](#rbenv)) * Javascript Runtime -These can be installed on Ubuntu 20.04 or later with: +These can be installed on Ubuntu 22.04 or later with: ``` sudo apt-get update -sudo apt-get install ruby2.7 libruby2.7 ruby2.7-dev \ +sudo apt-get install ruby ruby-dev ruby-bundler \ libvips-dev libxml2-dev libxslt1-dev nodejs \ - apache2 apache2-dev build-essential git-core firefox-geckodriver \ + build-essential git-core \ postgresql postgresql-contrib libpq-dev libsasl2-dev \ - libffi-dev libgd-dev libarchive-dev libbz2-dev yarnpkg -sudo gem2.7 install bundler + libffi-dev libgd-dev libarchive-dev libbz2-dev npm +sudo npm install --global yarn ``` ### Alternative platforms @@ -230,7 +230,7 @@ For simplicity, this document explains how to install all the website dependenci If you choose to install Ruby and Bundler via `rbenv`, then you do not need to install the system libraries for Ruby: -* For Ubuntu, you do not need to install the following packages: `ruby2.7 libruby2.7 ruby2.7-dev bundler`, +* For Ubuntu, you do not need to install the following packages: `ruby3.0 libruby3.0 ruby3.0-dev bundler`, * For Fedora, you do not need to install the following packages: `ruby ruby-devel rubygem-rdoc rubygem-bundler rubygems` * For MacOSX, you do not need to `brew install ruby` - but make sure you've installed a version of Ruby using `rbenv` before running `gem install bundler`! diff --git a/Vagrantfile b/Vagrantfile index 2ef899123..7895d3b86 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,7 @@ Vagrant.configure("2") do |config| # use official ubuntu image for virtualbox config.vm.provider "virtualbox" do |vb, override| - override.vm.box = "ubuntu/focal64" + override.vm.box = "ubuntu/jammy64" override.vm.synced_folder ".", "/srv/openstreetmap-website" vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--cpus", "2"] @@ -16,13 +16,13 @@ Vagrant.configure("2") do |config| # use third party image and sshfs or NFS sharing for lxc config.vm.provider "lxc" do |_, override| - override.vm.box = "generic/ubuntu2004" + override.vm.box = "generic/ubuntu2204" override.vm.synced_folder ".", "/srv/openstreetmap-website", :type => sharing_type end # use third party image and sshfs or NFS sharing for libvirt config.vm.provider "libvirt" do |_, override| - override.vm.box = "generic/ubuntu2004" + override.vm.box = "generic/ubuntu2204" override.vm.synced_folder ".", "/srv/openstreetmap-website", :type => sharing_type end diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index 44aa530d9..88d16bc8e 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -15,13 +15,55 @@ L.OSM.Map = L.Map.extend({ initialize: function (id, options) { L.Map.prototype.initialize.call(this, id, options); - var copyright = I18n.t("javascripts.map.copyright", { copyright_url: "/copyright" }); - var donate = I18n.t("javascripts.map.donate_link_text", { donate_url: "https://donate.openstreetmap.org" }); - var terms = I18n.t("javascripts.map.terms", { terms_url: "https://wiki.osmfoundation.org/wiki/Terms_of_Use" }); - var cyclosm = I18n.t("javascripts.map.cyclosm", { cyclosm_url: "https://www.cyclosm.org", osmfrance_url: "https://openstreetmap.fr/" }); - var thunderforest = I18n.t("javascripts.map.thunderforest", { thunderforest_url: "https://www.thunderforest.com/" }); - var memomaps = I18n.t("javascripts.map.opnvkarte", { memomaps_url: "https://memomaps.de/" }); - var hotosm = I18n.t("javascripts.map.hotosm", { hotosm_url: "https://www.hotosm.org/", osmfrance_url: "https://openstreetmap.fr/" }); + var copyright_link = $("", { + href: "/copyright", + text: I18n.t("javascripts.map.openstreetmap_contributors") + }).prop("outerHTML"); + var copyright = I18n.t("javascripts.map.copyright_text", { copyright_link: copyright_link }); + + var donate = $("", { + "href": "https://donate.openstreetmap.org", + "class": "donate-attr", + "text": I18n.t("javascripts.map.make_a_donation") + }).prop("outerHTML"); + + var terms = $("", { + href: "https://wiki.osmfoundation.org/wiki/Terms_of_Use", + text: I18n.t("javascripts.map.website_and_api_terms") + }).prop("outerHTML"); + + var cyclosm_link = $("", { + href: "https://www.cyclosm.org", + target: "_blank", + text: I18n.t("javascripts.map.cyclosm_name") + }).prop("outerHTML"); + var osm_france_link = $("", { + href: "https://openstreetmap.fr/", + target: "_blank", + text: I18n.t("javascripts.map.osm_france") + }).prop("outerHTML"); + var cyclosm = I18n.t("javascripts.map.cyclosm_credit", { cyclosm_link: cyclosm_link, osm_france_link: osm_france_link }); + + var thunderforest_link = $("", { + href: "https://www.thunderforest.com/", + target: "_blank", + text: I18n.t("javascripts.map.andy_allan") + }).prop("outerHTML"); + var thunderforest = I18n.t("javascripts.map.thunderforest_credit", { thunderforest_link: thunderforest_link }); + + var memomaps_link = $("", { + href: "https://memomaps.de/", + target: "_blank", + text: I18n.t("javascripts.map.memomaps") + }).prop("outerHTML"); + var memomaps = I18n.t("javascripts.map.opnvkarte_credit", { memomaps_link: memomaps_link }); + + var hotosm_link = $("", { + href: "https://www.hotosm.org/", + target: "_blank", + text: I18n.t("javascripts.map.hotosm_name") + }).prop("outerHTML"); + var hotosm = I18n.t("javascripts.map.hotosm_credit", { hotosm_link: hotosm_link, osm_france_link: osm_france_link }); this.baseLayers = []; diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 5a197d9b1..06f98cc57 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1253,22 +1253,6 @@ tr.turn:hover { display: none; } -/* Rules for "flash" notice boxes shown at the top of the content area */ - -.flash { - &.error { - background-color: #ff7070; - } - - &.warning { - background-color: #ffe0cc; - } - - &.notice { - background-color: #CBEEA7; - } -} - /* Rules for highlighting fields with rails validation errors */ .formError { diff --git a/app/assets/stylesheets/ltr/small.scss b/app/assets/stylesheets/ltr/small.scss deleted file mode 120000 index f3fd1a025..000000000 --- a/app/assets/stylesheets/ltr/small.scss +++ /dev/null @@ -1 +0,0 @@ -../small.scss \ No newline at end of file diff --git a/app/assets/stylesheets/rtl/small.r2.scss b/app/assets/stylesheets/rtl/small.r2.scss deleted file mode 120000 index f3fd1a025..000000000 --- a/app/assets/stylesheets/rtl/small.r2.scss +++ /dev/null @@ -1 +0,0 @@ -../small.scss \ No newline at end of file diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 124b29eff..44c19e322 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -21,7 +21,7 @@ class IssuesController < ApplicationController @issues = Issue.visible_to(current_user).order(:updated_at => :desc) # If search - if params[:search_by_user]&.present? + if params[:search_by_user].present? @find_user = User.find_by(:display_name => params[:search_by_user]) if @find_user @issues = @issues.where(:reported_user_id => @find_user.id) @@ -31,11 +31,11 @@ class IssuesController < ApplicationController end end - @issues = @issues.where(:status => params[:status]) if params[:status]&.present? + @issues = @issues.where(:status => params[:status]) if params[:status].present? - @issues = @issues.where(:reportable_type => params[:issue_type]) if params[:issue_type]&.present? + @issues = @issues.where(:reportable_type => params[:issue_type]) if params[:issue_type].present? - if params[:last_updated_by]&.present? + if params[:last_updated_by].present? last_updated_by = params[:last_updated_by].to_s == "nil" ? nil : params[:last_updated_by].to_i @issues = @issues.where(:updated_by => last_updated_by) end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index a05fe376b..5fb8aa111 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -113,7 +113,14 @@ class SiteController < ApplicationController def export; end - def offline; end + def offline + flash.now[:warning] = if Settings.status == "database_offline" + t("layouts.osm_offline") + else + t("layouts.osm_read_only") + end + render :html => nil, :layout => true + end def preview render :html => RichText.new(params[:type], params[:text]).to_html diff --git a/app/helpers/changesets_helper.rb b/app/helpers/changesets_helper.rb index 5773240ff..9d46de120 100644 --- a/app/helpers/changesets_helper.rb +++ b/app/helpers/changesets_helper.rb @@ -21,14 +21,10 @@ module ChangesetsHelper end if params.key?(:display_name) - t "browse.#{action}_html", - :time => time, - :title => title + t "browse.#{action}_ago_html", :time_ago => tag.abbr(time, :title => title) else - t "browse.#{action}_by_html", - :time => time, - :title => title, - :user => changeset_user_link(changeset) + t "browse.#{action}_ago_by_html", :time_ago => tag.abbr(time, :title => title), + :user => changeset_user_link(changeset) end end diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb index 86e5c40f8..42fd089e4 100644 --- a/app/helpers/note_helper.rb +++ b/app/helpers/note_helper.rb @@ -3,13 +3,13 @@ module NoteHelper def note_event(event, at, by) if by.nil? - t("notes.show.#{event}_by_anonymous_html", - :when => friendly_date_ago(at), - :exact_time => l(at)) + t("notes.show.event_#{event}_by_anonymous_html", + :time_ago => tag.abbr(friendly_date_ago(at), + :title => l(at))) else - t("notes.show.#{event}_by_html", - :when => friendly_date_ago(at), - :exact_time => l(at), + t("notes.show.event_#{event}_by_html", + :time_ago => tag.abbr(friendly_date_ago(at), + :title => l(at)), :user => note_author(by)) end end diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 8aa5b64c7..9eb6b5bfe 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -13,10 +13,10 @@