From: Adam Hoyle Date: Tue, 14 Dec 2021 10:42:42 +0000 (+0000) Subject: Merge branch 'master' into feature/add-communities-page X-Git-Tag: live~1973^2~23 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/46875fdde3ecdc37bb69e892b15509132a3bf9cf?hp=a1db3f9ae45c1be24a18a11e9713692bb30f61c4 Merge branch 'master' into feature/add-communities-page --- diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 000000000..ef67079ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,33 @@ +name: A Bug +description: Something has gone wrong when you were using the website. +# title: +# labels: +# assignees: +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: input + id: url + attributes: + label: URL + description: Please share the URL where the issue can be seen. + placeholder: https://www.openstreetmap.org/... + validations: + required: false + - type: textarea + id: steps-reproduce + attributes: + label: How to reproduce the issue? + description: Please share the steps to reproduce the issue. + placeholder: 1. ..., 2. ..., 3. ... + validations: + required: false + - type: textarea + attributes: + label: Screenshot(s) or anything else? + description: Please add screenshots or additional information to help us understand your issue. + placeholder: + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..0f40ec020 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: There is an issue with the default map layer shown on the front page + url: https://github.com/gravitystorm/openstreetmap-carto + about: Please share your feedback with the OpenStreetMap-Carto team + - name: There is an issue with the iD editor used on the Edit tab + url: https://github.com/openstreetmap/iD + about: Please share your feedback with the iD team + - name: There is an issue with the search results + url: https://github.com/osm-search/Nominatim + about: Please share your feedback with the Nominatim team diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 000000000..e556dfa72 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,21 @@ +name: 'Feature, Idea, Question' +description: You want to request a feature, share an idea or have a question. +# title: +# labels: +# assignees: +body: + - type: textarea + id: idea + attributes: + label: Description + description: Please describe you feature request, idea or question. + placeholder: + validations: + required: false + - type: textarea + attributes: + label: Screenshots + description: Please add screenshots if they can help us understand your request/idea/question. + placeholder: + validations: + required: false diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d718dcfa7..a24c745f2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout source - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Poke config run: | cp config/example.storage.yml config/storage.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aa9de33e2..6ae40a3f5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,13 +11,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Setup ruby uses: actions/setup-ruby@v1.1.3 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} @@ -35,13 +35,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Setup ruby uses: actions/setup-ruby@v1.1.3 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} @@ -59,20 +59,20 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Setup ruby uses: actions/setup-ruby@v1.1.3 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} restore-keys: | bundle-${{ env.os }}-${{ env.ruby }}- - name: Cache node modules - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: node_modules key: yarn-${{ env.os }}-${{ hashFiles('yarn.lock') }} @@ -94,13 +94,13 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Setup ruby uses: actions/setup-ruby@v1.1.3 with: ruby-version: ${{ env.ruby }} - name: Cache gems - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor/bundle key: bundle-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('Gemfile.lock') }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0aa52c4d7..1d7c50350 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,20 +15,20 @@ jobs: OPENSTREETMAP_MEMCACHE_SERVERS: 127.0.0.1 steps: - name: Checkout source - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: Setup ruby uses: actions/setup-ruby@v1.1.3 with: ruby-version: ${{ matrix.ruby }} - name: Cache gems - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor/bundle key: bundle-ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }}-${{ hashFiles('Gemfile.lock') }} restore-keys: | bundle-ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }}- - name: Cache node modules - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: node_modules key: yarn-ubuntu-${{ matrix.ubuntu }}-${{ hashFiles('yarn.lock') }} diff --git a/Gemfile b/Gemfile index 75cb1054b..108f44971 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,9 @@ gem "autoprefixer-rails" # Use image_optim to optimise images gem "image_optim_rails" +# Use argon2 for password hashing +gem "argon2" + # Load rails plugins gem "actionpack-page_caching", ">= 1.2.0" gem "activerecord-import" @@ -40,7 +43,7 @@ gem "active_record_union" gem "bootstrap", "~> 4.5.0" gem "bootstrap_form", "~> 4.0" gem "cancancan" -gem "composite_primary_keys", "~> 13.0.0" +gem "composite_primary_keys", "~> 13.0.0", "!= 13.0.1" gem "config" gem "delayed_job_active_record" gem "http_accept_language", "~> 2.1.1" @@ -96,6 +99,7 @@ gem "maxminddb" gem "rotp" # Load memcache client in case we are using it +gem "connection_pool" gem "dalli" gem "kgio" @@ -145,9 +149,9 @@ group :test do gem "rubocop" gem "rubocop-minitest" gem "rubocop-performance" - gem "rubocop-rails", "~> 2.11.3" # Bug in 2.12.0, fixed in master after 2.12.2 + gem "rubocop-rails" gem "rubocop-rake" - gem "selenium-webdriver" + gem "selenium-webdriver", "~> 3.142.7" gem "simplecov", :require => false gem "simplecov-lcov", :require => false gem "webmock" diff --git a/Gemfile.lock b/Gemfile.lock index 4f7f64b99..46f472d7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,21 +73,24 @@ GEM annotate (3.1.1) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) + argon2 (2.1.1) + ffi (~> 1.14) + ffi-compiler (~> 1.0) ast (2.4.2) autoprefixer-rails (10.3.3.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.513.0) - aws-sdk-core (3.121.1) + aws-partitions (1.539.0) + aws-sdk-core (3.124.0) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.49.0) - aws-sdk-core (~> 3, >= 3.120.0) + aws-sdk-kms (1.52.0) + aws-sdk-core (~> 3, >= 3.122.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.103.0) - aws-sdk-core (~> 3, >= 3.120.0) + aws-sdk-s3 (1.109.0) + aws-sdk-core (~> 3, >= 3.122.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.4.0) @@ -106,7 +109,7 @@ GEM smart_properties binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.9.1) + bootsnap (1.9.3) msgpack (~> 1.0) bootstrap (4.5.3) autoprefixer-rails (>= 9.1.0) @@ -115,16 +118,17 @@ GEM bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) - brakeman (5.1.1) + brakeman (5.1.2) browser (5.3.1) builder (3.2.4) bzip2-ffi (1.1.0) ffi (~> 1.0) cancancan (3.3.0) - canonical-rails (0.2.12) - rails (>= 4.1, < 6.2) - capybara (3.35.3) + canonical-rails (0.2.13) + rails (>= 4.1, <= 7.0) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) @@ -139,10 +143,11 @@ GEM config (3.1.0) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) + connection_pool (2.2.5) crack (0.4.5) rexml crass (1.0.6) - dalli (2.7.11) + dalli (3.1.0) debug_inspector (1.1.0) deep_merge (1.2.1) delayed_job (4.1.9) @@ -223,26 +228,29 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) ffi (1.15.4) + ffi-compiler (1.0.1) + ffi (>= 1.0.0) + rake ffi-libarchive (1.1.3) ffi (~> 1.0) fspath (3.1.2) gd2-ffij (0.4.0) ffi (>= 1.0.0) - globalid (0.5.2) + globalid (1.0.0) activesupport (>= 5.0) hashdiff (1.0.1) - hashie (4.1.0) + hashie (5.0.0) html_tokenizer (0.0.7) htmlentities (4.3.4) http_accept_language (2.1.1) - i18n (1.8.10) + i18n (1.8.11) concurrent-ruby (~> 1.0) i18n-js (3.9.0) i18n (>= 0.6.6) - image_optim (0.31.0) + image_optim (0.31.1) exifr (~> 1.2, >= 1.2.2) fspath (~> 3.0) - image_size (>= 1.5, < 3) + image_size (>= 1.5, < 4) in_threads (~> 1.3) progress (~> 3.0, >= 3.0.1) image_optim_rails (0.4.3) @@ -252,16 +260,16 @@ GEM image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - image_size (2.1.2) + image_size (3.0.1) in_threads (1.5.4) - jbuilder (2.11.2) + jbuilder (2.11.3) activesupport (>= 5.0.0) jmespath (1.4.0) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.5.1) + json (2.6.1) jwt (2.3.0) kgio (2.11.4) kramdown (2.3.1) @@ -279,6 +287,7 @@ GEM mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) + matrix (0.4.2) maxminddb (0.1.22) method_source (1.0.0) mini_magick (4.11.0) @@ -309,7 +318,7 @@ GEM hashie (>= 3.4.6) rack (>= 1.6.2, < 3) rack-protection - omniauth-facebook (8.0.0) + omniauth-facebook (9.0.0) omniauth-oauth2 (~> 1.2) omniauth-github (2.0.0) omniauth (~> 2.0) @@ -325,7 +334,7 @@ GEM omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) - omniauth-oauth2 (1.7.1) + omniauth-oauth2 (1.7.2) oauth2 (~> 1.4) omniauth (>= 1.9, < 3) omniauth-openid (2.0.1) @@ -339,17 +348,17 @@ GEM omniauth-oauth2 (~> 1.4) openstreetmap-deadlock_retry (1.3.1) parallel (1.21.0) - parser (3.0.2.0) + parser (3.0.3.1) ast (~> 2.4.1) pg (1.2.3) popper_js (1.16.0) progress (3.6.0) public_suffix (4.0.6) - puma (5.5.1) + puma (5.5.2) nio4r (~> 2.0) quad_tile (1.0.1) r2 (0.2.7) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) @@ -399,13 +408,13 @@ GEM rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.1.1) + regexp_parser (2.2.0) request_store (1.5.0) rack (>= 1.4) rexml (3.2.5) rinku (2.0.6) rotp (6.2.0) - rubocop (1.22.1) + rubocop (1.23.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -414,14 +423,14 @@ GEM rubocop-ast (>= 1.12.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.12.0) + rubocop-ast (1.14.0) parser (>= 3.0.1.1) - rubocop-minitest (0.15.2) + rubocop-minitest (0.17.0) rubocop (>= 0.90, < 2.0) - rubocop-performance (1.11.5) + rubocop-performance (1.12.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.11.3) + rubocop-rails (2.12.4) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) @@ -429,7 +438,7 @@ GEM rubocop (~> 1.0) ruby-openid (2.9.2) ruby-progressbar (1.11.0) - ruby-vips (2.1.3) + ruby-vips (2.1.4) ffi (~> 1.12) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -459,13 +468,13 @@ GEM sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.1) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) strong_migrations (0.7.8) activerecord (>= 5) - terser (1.1.7) + terser (1.1.8) execjs (>= 0.3.0, < 3) thor (1.1.0) tilt (2.0.10) @@ -484,7 +493,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.4.2) + zeitwerk (2.5.1) PLATFORMS ruby @@ -495,6 +504,7 @@ DEPENDENCIES active_record_union activerecord-import annotate + argon2 autoprefixer-rails aws-sdk-s3 better_errors @@ -508,8 +518,9 @@ DEPENDENCIES cancancan canonical-rails capybara (>= 2.15) - composite_primary_keys (~> 13.0.0) + composite_primary_keys (~> 13.0.0, != 13.0.1) config + connection_pool dalli debug_inspector delayed_job_active_record @@ -560,12 +571,12 @@ DEPENDENCIES rubocop rubocop-minitest rubocop-performance - rubocop-rails (~> 2.11.3) + rubocop-rails rubocop-rake sanitize sassc-rails secure_headers - selenium-webdriver + selenium-webdriver (~> 3.142.7) simplecov simplecov-lcov strong_migrations diff --git a/Vendorfile b/Vendorfile index 6b586f9ce..0c1f52335 100644 --- a/Vendorfile +++ b/Vendorfile @@ -43,7 +43,6 @@ folder 'vendor/assets' do end folder 'polyfill' do - file 'es5.js', 'https://polyfill.io/v3/polyfill.js?features=es5&flags=gated,always' file 'es6.js', 'https://polyfill.io/v3/polyfill.js?features=es6&flags=gated,always' end end diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 8d66a7fef..33a4d7c32 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -19,8 +19,6 @@ //= link_directory ../../../vendor/assets/polyfill .js -//= link html5shiv/dist/html5shiv.js - //= link leaflet/dist/images/marker-icon.png //= link leaflet/dist/images/marker-icon-2x.png //= link leaflet/dist/images/marker-shadow.png diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index f8cd32438..d9fa276ba 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -79,6 +79,16 @@ a { color: $blue; } +/* Rules for borders */ +/* These add additional colours to those provided by bootstrap */ +.border-grey { + border-color: $grey !important; +} + +.border-lightgrey { + border-color: $lightgrey !important; +} + /* Rules for the header */ #menu-icon { @@ -216,11 +226,6 @@ nav.secondary { } } - img.user_thumbnail_tiny { - border: 0; - border-radius: 3px; - } - #inboxanchor { display: inline-block; height: 25px; @@ -370,8 +375,6 @@ body.compact-nav { } h3, h4 { - margin-top: $lineheight; - margin-bottom: $lineheight/2; font-size: 1.25rem; } @@ -390,23 +393,6 @@ body.compact-nav { top: 20px; } } - - .icon.close { - float: right; - cursor: pointer; - } - - .flash { - padding: 15px; - - picture { - margin-right: -25px; - } - - div.message { - margin-left: 30px; - } - } } .overlay-sidebar #sidebar { @@ -813,7 +799,6 @@ tr.turn:hover { border-bottom: 1px solid $grey; h4:first-child { - margin-top: 0; word-wrap: break-word; } } @@ -822,42 +807,13 @@ tr.turn:hover { border-bottom: none; } - .paginate { - float: right; - padding: 1px 6px; - border: 1px solid $lightgrey; - border-radius: 3px; - } - - .browse-field { - margin-bottom: 10px; - - h4 { - padding: 5px 0 5px 10px; - font-size: 12px; - border: 1px solid $grey; - border-radius: 4px 4px 0 0; - background-color: $offwhite; - } - - p { - padding: 7px 10px; - font-size: 12px; - background-color: #FFF; - border: 1px solid $grey; - border-top: 0; - border-radius: 0 0 4px 4px; - } - } - .browse-tag-list { background-color: $offwhite; - border: 1px solid $grey; - border-radius: 3px; table-layout: fixed; border-collapse: separate; border-spacing: 0; width: 100%; + margin-bottom: $spacer; th, td { border-bottom: 1px solid $grey; @@ -904,16 +860,6 @@ tr.turn:hover { } } - .comments-header { - float: left; - } - - .subscribe-buttons { - float: left; - margin: 18px 10px 10px; - min-width: 80px; - } - .subscribe-buttons input { font-size: 90%; line-height: 15px; @@ -966,7 +912,7 @@ tr.turn:hover { } .export_area_inputs { - margin-bottom: $lineheight/2; + margin-bottom: $spacer; input[type="text"] { width: 100px; text-align: center; @@ -975,8 +921,6 @@ tr.turn:hover { .export_boxy { background: $lightgrey; - border: 1px solid $grey; - border-radius: 3px; #maxlat { margin-top: -1px; } #minlon { @@ -1063,6 +1007,7 @@ tr.turn:hover { background-image: image-url("sign-up-illustration-arm.png"); position: absolute; z-index: 100; + pointer-events: none; } } @@ -1083,7 +1028,6 @@ tr.turn:hover { .content_map { height: 200px; - border: 1px solid $grey; margin-bottom: $lineheight; } @@ -1093,13 +1037,6 @@ tr.turn:hover { } } -/* Rules for the user profile page */ - -.contact-activity { - margin-top: $lineheight; - width: 100%; -} - /* Rules for the user map */ .content_map .leaflet-popup-content { @@ -1116,30 +1053,12 @@ tr.turn:hover { margin-top: 0 0 0 60px; font-size: 12px; } - img.user_thumbnail { - float: left; - margin: 0 $lineheight/2 0 0; - } } /* Rules for the user list */ #user_list { width: 100%; - - tr { - vertical-align: middle; - } - - p { - margin-top: 0px; - margin-bottom: 0px; - } -} - -#user_list_actions { - float: right; - margin-top: $lineheight/2; } /* Rules for the diary list page */ @@ -1150,26 +1069,9 @@ tr.turn:hover { padding-bottom: $lineheight/2; border-top: 1px solid $grey; - &:first-of-type { - margin-top: $lineheight/2; - } - &.deleted { background-color: #fee; } - - .post_heading { - margin-bottom: $lineheight; - - h2 { - margin-top: 0; - margin-bottom: $lineheight/2; - } - } - - img.user_thumbnail { - float: left; - } } /* Rules for the diary entry page */ @@ -1177,7 +1079,6 @@ tr.turn:hover { .diary_entries { #map { height: 400px; - border: 1px solid $grey; display: none; margin-bottom: $lineheight; } @@ -1206,10 +1107,6 @@ tr.turn:hover { } } -.diary_entries-show img.user_thumbnail { - float: left; -} - /* Rules for the log in page */ #login_auth_buttons { @@ -1225,7 +1122,6 @@ tr.turn:hover { .users-terms { .legale { - border: 1px solid $grey; padding: $lineheight; margin-bottom: $lineheight; overflow: auto; @@ -1338,8 +1234,6 @@ tr.turn:hover { /* Rules for "flash" notice boxes shown at the top of the content area */ .flash { - padding: $lineheight; - &.error { background-color: #ff7070; } @@ -1423,29 +1317,11 @@ tr.turn:hover { img.user_image { max-width: 100px; max-height: 100px; - border: 1px solid $grey; - margin-bottom: $lineheight; - float: left; - margin-right: $lineheight; -} - -img.user_image_no_margins { - max-width: 100px; - max-height: 100px; - border: 1px solid $grey; } img.user_thumbnail { max-width: 50px; max-height: 50px; - border: 1px solid $grey; - margin-right: $lineheight; -} - -img.user_thumbnail_no_margins { - max-width: 50px; - max-height: 50px; - border: 1px solid $grey; } img.user_thumbnail_tiny { @@ -1453,7 +1329,6 @@ img.user_thumbnail_tiny { height: auto; max-width: 25px; max-height: 25px; - border: 1px solid $grey; } /* Rules for geo microformats */ @@ -1611,10 +1486,6 @@ dl.dl-inline { } } -.comments .richtext { - margin-left: 70px; -} - /* Rules for the user notes list */ .note_list { @@ -1744,8 +1615,8 @@ dl.dl-inline { .byosm span { display: inline-block; - width: 20px; - margin-left: -20px; + width: 1em; + margin-left: -1em; } } diff --git a/app/assets/stylesheets/leaflet-all.scss b/app/assets/stylesheets/leaflet-all.scss index 34e3d094e..d12c61f77 100644 --- a/app/assets/stylesheets/leaflet-all.scss +++ b/app/assets/stylesheets/leaflet-all.scss @@ -15,9 +15,6 @@ div.leaflet-marker-icon.location-filter.move-marker { /* Override some conflicting styles. https://github.com/openstreetmap/openstreetmap-website/pull/121#issuecomment-10206946 */ -.leaflet-popup-content img.user_thumbnail { - max-width: 50px !important; -} .user_popup p { margin: 0 !important; diff --git a/app/assets/stylesheets/parameters.scss b/app/assets/stylesheets/parameters.scss index d1d3db573..6cbbf1a27 100644 --- a/app/assets/stylesheets/parameters.scss +++ b/app/assets/stylesheets/parameters.scss @@ -15,6 +15,5 @@ $hovercolor: 20%; $headerHeight: 55px; $sidebarWidth: 350px; $keyline: 1px solid $lightgrey; -$border-radius: 3px; $list-highlight: #FFFFC0; $border: 1px solid $grey; diff --git a/app/controllers/api/traces_controller.rb b/app/controllers/api/traces_controller.rb index 6c77f9dc4..43bbeeb1d 100644 --- a/app/controllers/api/traces_controller.rb +++ b/app/controllers/api/traces_controller.rb @@ -38,7 +38,7 @@ module Api if trace.user == current_user trace.visible = false trace.save! - TraceDestroyerJob.perform_later(trace) if Settings.trace_use_job_queue + TraceDestroyerJob.perform_later(trace) head :ok else @@ -79,7 +79,7 @@ module Api trace = do_create(params[:file], tags, description, visibility) if trace.id - TraceImporterJob.perform_later(trace) if Settings.trace_use_job_queue + TraceImporterJob.perform_later(trace) render :plain => trace.id.to_s elsif trace.valid? head :internal_server_error diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 517b11e14..07b23ce21 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -381,19 +381,23 @@ class ApplicationController < ActionController::Base # clean any referer parameter def safe_referer(referer) - referer = URI.parse(referer) + begin + referer = URI.parse(referer) + + if referer.scheme == "http" || referer.scheme == "https" + referer.scheme = nil + referer.host = nil + referer.port = nil + elsif referer.scheme || referer.host || referer.port + referer = nil + end - if referer.scheme == "http" || referer.scheme == "https" - referer.scheme = nil - referer.host = nil - referer.port = nil - elsif referer.scheme || referer.host || referer.port + referer = nil if referer&.path&.first != "/" + rescue URI::InvalidURIError referer = nil end - referer = nil if referer&.path&.first != "/" - - referer.to_s + referer&.to_s end def scope_enabled?(scope) diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 50d0ae0a5..6c5336908 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -5,6 +5,7 @@ class BrowseController < ApplicationController before_action :set_locale before_action -> { check_database_readable(:need_api => true) } before_action :require_oauth + before_action :update_totp, :only => [:query] around_action :web_timeout authorize_resource :class => false @@ -88,4 +89,6 @@ class BrowseController < ApplicationController rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end + + def query; end end diff --git a/app/controllers/concerns/session_methods.rb b/app/controllers/concerns/session_methods.rb index dd6458b1b..eb24f6b20 100644 --- a/app/controllers/concerns/session_methods.rb +++ b/app/controllers/concerns/session_methods.rb @@ -69,7 +69,7 @@ module SessionMethods def failed_login(message, username = nil) flash[:error] = message - redirect_to :action => "new", :referer => session[:referer], + redirect_to :controller => "sessions", :action => "new", :referer => session[:referer], :username => username, :remember_me => session[:remember_me] session.delete(:remember_me) diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index 12f31bad2..312e1e54c 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -235,6 +235,8 @@ class DiaryEntriesController < ApplicationController end def comments + @title = t ".title", :user => @user.display_name + conditions = { :user_id => @user } conditions[:visible] = true unless can? :unhidecomment, DiaryEntry diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 3bc958615..caadd5121 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -4,14 +4,23 @@ class ErrorsController < ApplicationController skip_authorization_check def forbidden - render :status => :forbidden + respond_to do |format| + format.html { render :status => :forbidden } + format.any { render :status => :forbidden, :plain => "" } + end end def not_found - render :status => :not_found + respond_to do |format| + format.html { render :status => :not_found } + format.any { render :status => :not_found, :plain => "" } + end end def internal_server_error - render :status => :internal_server_error + respond_to do |format| + format.html { render :status => :internal_server_error } + format.any { render :status => :internal_server_error, :plain => "" } + end end end diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index 5cdb2a4e4..93dffb4a3 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -28,11 +28,9 @@ class FriendshipsController < ApplicationController friendship.add_error(t("friendships.make_friend.failed", :name => @new_friend.display_name)) end - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_path - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_path end else render_unknown_user params[:display_name] @@ -51,11 +49,9 @@ class FriendshipsController < ApplicationController flash[:error] = t "friendships.remove_friend.not_a_friend", :name => @friend.display_name end - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_path - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_path end else render_unknown_user params[:display_name] diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index dacd00261..a95e2e587 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -119,8 +119,10 @@ class MessagesController < ApplicationController if @message.save && !request.xhr? flash[:notice] = t ".destroyed" - if params[:referer] - redirect_to safe_referer(params[:referer]) + referer = safe_referer(params[:referer]) if params[:referer] + + if referer + redirect_to referer else redirect_to :action => :inbox end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 7e6a740f3..bb3854e69 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -34,10 +34,14 @@ class SessionsController < ApplicationController token&.destroy session.delete(:token) end + session.delete(:user) session_expires_automatically - if params[:referer] - redirect_to safe_referer(params[:referer]) + + referer = safe_referer(params[:referer]) if params[:referer] + + if referer + redirect_to referer else redirect_to :controller => "site", :action => "index" end diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index b4853c6b8..9ebad1613 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -110,7 +110,7 @@ class TracesController < ApplicationController flash[:notice] = t ".trace_uploaded" flash[:warning] = t ".traces_waiting", :count => current_user.traces.where(:inserted => false).count if current_user.traces.where(:inserted => false).count > 4 - TraceImporterJob.perform_later(@trace) if Settings.trace_use_job_queue + TraceImporterJob.perform_later(@trace) redirect_to :action => :index, :display_name => current_user.display_name else flash[:error] = t("traces.create.upload_failed") if @trace.valid? @@ -194,7 +194,7 @@ class TracesController < ApplicationController trace.visible = false trace.save flash[:notice] = t ".scheduled_for_deletion" - TraceDestroyerJob.perform_later(trace) if Settings.trace_use_job_queue + TraceDestroyerJob.perform_later(trace) redirect_to :action => :index, :display_name => trace.user.display_name end rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 42ac6ac11..23263ebba 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -44,11 +44,9 @@ class UsersController < ApplicationController flash[:notice] = { :partial => "users/terms_declined_flash" } if current_user.save - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_account_path(current_user) - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_account_path(current_user) elsif params[:decline] redirect_to t("users.terms.declined") else @@ -64,11 +62,9 @@ class UsersController < ApplicationController flash[:notice] = t "users.new.terms accepted" if current_user.save end - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_account_path(current_user) - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_account_path(current_user) else self.current_user = session.delete(:new_user) @@ -335,23 +331,15 @@ class UsersController < ApplicationController ## # omniauth failure callback def auth_failure - flash[:error] = t("users.auth_failure.#{params[:message]}") - redirect_to params[:origin] || login_url - end - - private + flash[:error] = t(params[:message], :scope => "users.auth_failure", :default => t("users.auth_failure.unknown_error")) - ## - # - def unconfirmed_login(user) - session[:token] = user.tokens.create.token + origin = safe_referer(params[:origin]) if params[:origin] - redirect_to :action => "confirm", :display_name => user.display_name - - session.delete(:remember_me) - session.delete(:referer) + redirect_to origin || login_url end + private + ## # update a user's details def update_user(user, params) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c9f165d52..bb09f3a49 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -71,5 +71,7 @@ module ApplicationHelper else flash end + rescue StandardError + flash.inspect if Rails.env.development? end end diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index f9cc99621..57b786792 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -1,6 +1,8 @@ require "ostruct" module ReportsHelper + Category = Struct.new(:id, :label) + def report_link(name, reportable) link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name) end @@ -8,7 +10,7 @@ module ReportsHelper # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects def report_categories(reportable) Report.categories_for(reportable).map do |c| - OpenStruct.new(:id => c, :label => t(".categories.#{reportable.class.name.underscore}.#{c}_label")) + Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label")) end end end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb index eed55cd9d..a6161fa43 100644 --- a/app/helpers/user_helper.rb +++ b/app/helpers/user_helper.rb @@ -2,7 +2,7 @@ module UserHelper # User images def user_image(user, options = {}) - options[:class] ||= "user_image" + options[:class] ||= "user_image border border-grey" options[:alt] ||= "" if user.image_use_gravatar @@ -15,7 +15,7 @@ module UserHelper end def user_thumbnail(user, options = {}) - options[:class] ||= "user_thumbnail" + options[:class] ||= "user_thumbnail border border-grey" options[:alt] ||= "" if user.image_use_gravatar @@ -28,7 +28,7 @@ module UserHelper end def user_thumbnail_tiny(user, options = {}) - options[:class] ||= "user_thumbnail_tiny" + options[:class] ||= "user_thumbnail_tiny border border-grey" options[:alt] ||= "" if user.image_use_gravatar diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 356207754..5505ee4a9 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -11,7 +11,7 @@ <% end %>

-
+

<%= t "browse.#{common_details.visible? ? :edited : :deleted}_by_html", :time => time_ago_in_words(common_details.timestamp, :scope => :"datetime.distance_in_words_ago"), :user => changeset_user_link(common_details.changeset), @@ -19,7 +19,7 @@ · <%= t "browse.in_changeset" %> #<%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %> -

+

<% if @type == "node" and common_details.visible? %>
diff --git a/app/views/browse/_paging_nav.html.erb b/app/views/browse/_paging_nav.html.erb index 67f1c75a3..e13b1a9b8 100644 --- a/app/views/browse/_paging_nav.html.erb +++ b/app/views/browse/_paging_nav.html.erb @@ -1,5 +1,14 @@ -<% if pages.page_count > 1 %> - - <%= raw pagination_links_each(pages, {}) { |n| link_to(n, page_param => n) } %> - -<% end %> +
+
+

<%= heading %>

+
+ <% if pages.page_count > 1 %> +
+

+ + <%= raw pagination_links_each(pages, {}) { |n| link_to(n, page_param => n) } %> + +

+
+ <% end %> +
diff --git a/app/views/browse/_tag_details.html.erb b/app/views/browse/_tag_details.html.erb index 0e1a3fbef..0868bb8e5 100644 --- a/app/views/browse/_tag_details.html.erb +++ b/app/views/browse/_tag_details.html.erb @@ -1,6 +1,6 @@ <% unless tag_details.empty? %>

<%= t ".tags" %>

- +
<%= render :partial => "tag", :collection => tag_details.sort %>
<% end %> diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index 079915fcf..6aa0f11fb 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -6,25 +6,29 @@

<%= linkify(@changeset.tags["comment"].to_s.presence || t("browse.no_comment")) %>

-
<%= changeset_details(@changeset) %>
+

<%= changeset_details(@changeset) %>

<%= render :partial => "tag_details", :object => @changeset.tags.except("comment") %> -

<%= t(".discussion") %>

- - <% if current_user %> -