From: Tom Hughes Date: Tue, 28 Nov 2023 18:11:40 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/4352' X-Git-Tag: live~1093 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/c7a4705c904935fe42658daafa0aa5175132cdd6?hp=b18ba50420cc5b9472c6628814095cc0ff0ca64b Merge remote-tracking branch 'upstream/pull/4352' --- diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2050aaf3f..0608b699b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,6 +19,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Run rubocop run: bundle exec rubocop --format fuubar @@ -32,6 +33,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Run erblint run: bundle exec erblint . @@ -45,6 +47,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Cache node modules uses: actions/cache@v3 @@ -69,6 +72,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Run brakeman run: bundle exec brakeman -q @@ -84,6 +88,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Setup database run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3ee6129e1..2588a737f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + rubygems: 3.4.10 bundler-cache: true - name: Cache node modules uses: actions/cache@v3 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e3407c6dc..bd2f92309 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -61,7 +61,7 @@ Metrics/BlockNesting: # Offense count: 26 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 286 + Max: 297 # Offense count: 59 # Configuration parameters: AllowedMethods, AllowedPatterns. diff --git a/Gemfile b/Gemfile index f9f12d64e..98b035188 100644 --- a/Gemfile +++ b/Gemfile @@ -26,8 +26,8 @@ gem "jbuilder", "~> 2.7" # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", ">= 1.4.2", :require => false -# Use R2 for RTL conversion -gem "r2", "~> 0.2.7" +# Use rtlcss for RTL conversion +gem "rtlcss" # Use autoprefixer to generate CSS prefixes gem "autoprefixer-rails" diff --git a/Gemfile.lock b/Gemfile.lock index c313665c4..885de22b4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,7 +65,7 @@ GEM activemodel (= 7.1.2) activesupport (= 7.1.2) timeout (>= 0.4.0) - activerecord-import (1.5.0) + activerecord-import (1.5.1) activerecord (>= 4.2) activestorage (7.1.2) actionpack (= 7.1.2) @@ -95,8 +95,8 @@ GEM autoprefixer-rails (10.4.15.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.849.0) - aws-sdk-core (3.186.0) + aws-partitions (1.854.0) + aws-sdk-core (3.187.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -104,7 +104,7 @@ GEM aws-sdk-kms (1.72.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.136.0) + aws-sdk-s3 (1.137.0) aws-sdk-core (~> 3, >= 3.181.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.6) @@ -233,7 +233,7 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (2.7.11) + faraday (2.7.12) base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) @@ -251,7 +251,7 @@ GEM ffi (>= 1.0.0) globalid (1.2.1) activesupport (>= 6.1) - google-protobuf (3.25.0) + google-protobuf (3.25.1) hashdiff (1.0.1) hashie (5.0.0) highline (2.1.0) @@ -288,7 +288,7 @@ GEM image_size (3.3.0) in_threads (1.6.0) io-console (0.6.0) - irb (1.9.0) + irb (1.9.1) rdoc reline (>= 0.3.8) jbuilder (2.11.5) @@ -305,6 +305,7 @@ GEM kramdown (2.4.0) rexml language_server-protocol (3.17.0.3) + libv8-node (18.16.0.0) libxml-ruby (4.1.2) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -326,6 +327,8 @@ GEM mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.5) + mini_racer (0.8.0) + libv8-node (~> 18.16.0.0) minitest (5.20.0) msgpack (1.7.2) multi_json (1.15.0) @@ -340,8 +343,8 @@ GEM timeout net-smtp (0.4.0) net-protocol - nio4r (2.5.9) - nokogiri (1.15.4) + nio4r (2.6.1) + nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth (0.4.7) @@ -399,11 +402,10 @@ GEM progress (3.6.0) psych (5.1.1.1) stringio - public_suffix (5.0.3) + public_suffix (5.0.4) puma (5.6.7) nio4r (~> 2.0) quad_tile (1.0.1) - r2 (0.2.8) racc (1.7.3) rack (2.2.8) rack-cors (2.0.1) @@ -473,6 +475,8 @@ GEM rinku (2.0.6) rotp (6.3.0) rouge (4.2.0) + rtlcss (0.2.1) + mini_racer (>= 0.6.3) rubocop (1.57.2) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -495,10 +499,11 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.22.1) + rubocop-rails (2.22.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) ruby-openid (2.9.2) @@ -638,7 +643,6 @@ DEPENDENCIES pg puma (~> 5.6) quad_tile (~> 1.0.1) - r2 (~> 0.2.7) rack-cors rack-uri_sanitizer rails (~> 7.1.0) @@ -646,6 +650,7 @@ DEPENDENCIES rails-i18n (~> 7.0.0) rinku (>= 2.0.6) rotp + rtlcss rubocop rubocop-capybara rubocop-factory_bot diff --git a/app/abilities/api_ability.rb b/app/abilities/api_ability.rb index fe39f5eb5..4876380d0 100644 --- a/app/abilities/api_ability.rb +++ b/app/abilities/api_ability.rb @@ -12,7 +12,7 @@ class ApiAbility if Settings.status != "database_offline" can [:show, :download, :query], Changeset - can [:index, :create, :comment, :feed, :show, :search], Note + can [:index, :create, :feed, :show, :search], Note can :index, Tracepoint can [:index, :show], User can [:index, :show], Node @@ -31,7 +31,7 @@ class ApiAbility if Settings.status != "database_offline" can [:index, :new, :create, :show, :edit, :update, :destroy], ClientApplication can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message - can [:close, :reopen], Note + can [:comment, :close, :reopen], Note can [:new, :create], Report can [:create, :show, :update, :destroy, :data], Trace can [:details, :gpx_files], User diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index af67244bc..0bfff869e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -103,6 +103,8 @@ $(document).ready(function () { $("body").removeClass("compact-nav"); + $("header").removeClass("text-nowrap"); + updateHeader(); $(window).resize(updateHeader); diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js index 6a3400d34..bcd5839cd 100644 --- a/app/assets/javascripts/leaflet.key.js +++ b/app/assets/javascripts/leaflet.key.js @@ -24,7 +24,7 @@ L.OSM.key = function (options) { } function updateButton() { - var disabled = ["mapnik", "cyclemap"].indexOf(map.getMapBaseLayerId()) === -1; + var disabled = OSM.LAYERS_WITH_MAP_KEY.indexOf(map.getMapBaseLayerId()) === -1; button .toggleClass("disabled", disabled) .attr("data-bs-original-title", diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index c096a92fc..eb351fa02 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -46,10 +46,13 @@ L.OSM.share = function (options) { .text(I18n.t("javascripts.share.short_link"))) .append($("") .attr("for", "embed_html") + .attr("id", "embed_link") + .attr("data-bs-title", I18n.t("javascripts.site.embed_html_disabled")) .attr("href", "#") .text(I18n.t("javascripts.share.embed"))) .on("click", "a", function (e) { e.preventDefault(); + if (!$(this).hasClass("btn-primary")) return; var id = "#" + $(this).attr("for"); $(this).siblings("a") .removeClass("active"); @@ -309,6 +312,7 @@ L.OSM.share = function (options) { } function update() { + var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo"; var bounds = map.getBounds(); $("#link_marker") @@ -334,6 +338,14 @@ L.OSM.share = function (options) { params.marker = latLng.lat + "," + latLng.lng; } + $("#embed_link") + .toggleClass("btn-primary", canEmbed) + .toggleClass("btn-secondary", !canEmbed) + .tooltip(canEmbed ? "disable" : "enable"); + if (!canEmbed && $("#embed_link").hasClass("active")) { + $("#long_link").click(); + } + $("#embed_html").val( "