From: Tom Hughes Date: Wed, 21 Jul 2021 10:24:17 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/3237' X-Git-Tag: live~2110 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4d47cff5e1d359fa27c5c46d2706faae39a3eacc?hp=b4a1e41968e1befdf6fc14715d95549f5537abca Merge remote-tracking branch 'upstream/pull/3237' --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d6a06b549..0aa52c4d7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,7 +68,7 @@ jobs: - name: Run tests run: bundle exec rails test:all - name: Report completion to Coveralls - uses: coverallsapp/github-action@v1.1.2 + uses: coverallsapp/github-action@1.1.3 with: github-token: ${{ secrets.github_token }} flag-name: ubuntu-${{ matrix.ubuntu }}-ruby-${{ matrix.ruby }} @@ -79,7 +79,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Report completion to Coveralls - uses: coverallsapp/github-action@v1.1.2 + uses: coverallsapp/github-action@1.1.3 with: github-token: ${{ secrets.github_token }} parallel-finished: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a0b57f586..32514771c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2021-01-11 19:00:54 UTC using RuboCop version 1.8.1. +# on 2021-06-29 17:25:37 UTC using RuboCop version 1.18.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,14 +14,14 @@ require: - rubocop-rails - rubocop-rake -# Offense count: 544 +# Offense count: 510 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: Max: 270 -# Offense count: 36 +# Offense count: 34 # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: Exclude: @@ -50,12 +50,12 @@ Lint/DuplicateBranch: - 'app/helpers/browse_tags_helper.rb' - 'lib/password_hash.rb' -# Offense count: 487 +# Offense count: 631 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 235 -# Offense count: 62 +# Offense count: 68 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. # IgnoredMethods: refine Metrics/BlockLength: @@ -66,17 +66,17 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 5 -# Offense count: 24 +# Offense count: 25 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 587 + Max: 361 -# Offense count: 52 +# Offense count: 56 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: - Max: 26 + Max: 25 -# Offense count: 553 +# Offense count: 703 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 179 @@ -86,14 +86,14 @@ Metrics/MethodLength: Metrics/ParameterLists: Max: 6 -# Offense count: 56 +# Offense count: 60 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 26 -# Offense count: 365 +# Offense count: 519 Minitest/MultipleAssertions: - Max: 97 + Max: 88 # Offense count: 4 Naming/AccessorMethodName: @@ -102,6 +102,21 @@ Naming/AccessorMethodName: - 'app/helpers/title_helper.rb' - 'lib/osm.rb' +# Offense count: 21 +# Configuration parameters: CheckIdentifiers, CheckConstants, CheckVariables, CheckStrings, CheckSymbols, CheckComments, CheckFilepaths, FlaggedTerms. +Naming/InclusiveLanguage: + Exclude: + - 'app/controllers/sessions_controller.rb' + - 'app/controllers/users_controller.rb' + - 'app/helpers/browse_tags_helper.rb' + - 'app/views/api/capabilities/show.builder' + - 'app/views/confirmations/_resend_success_flash.html.erb' + - 'app/views/users/suspended.html.erb' + - 'config/environments/production.rb' + - 'config/initializers/canonical_rails.rb' + - 'config/initializers/config.rb' + - 'config/initializers/doorkeeper.rb' + # Offense count: 8 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. # NamePrefix: is_, has_, have_ @@ -142,6 +157,9 @@ Rails/HelperInstanceVariable: Exclude: - 'app/helpers/title_helper.rb' +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb Rails/LexicallyScopedActionFilter: Exclude: - 'app/controllers/oauth2_applications_controller.rb' @@ -157,7 +175,7 @@ Rails/NotNullColumn: - 'db/migrate/025_add_end_time_to_changesets.rb' - 'db/migrate/20120404205604_add_user_and_description_to_redaction.rb' -# Offense count: 8 +# Offense count: 9 Rails/OutputSafety: Exclude: - 'app/controllers/sessions_controller.rb' @@ -166,30 +184,30 @@ Rails/OutputSafety: - 'lib/rich_text.rb' - 'test/helpers/application_helper_test.rb' -# Offense count: 80 +# Offense count: 91 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: strict, flexible Rails/TimeZone: Enabled: false -# Offense count: 8 +# Offense count: 6 +# Cop supports --auto-correct. Rake/Desc: Exclude: - 'lib/tasks/auto_annotate_models.rake' - 'lib/tasks/eslint.rake' - 'lib/tasks/subscribe_diary_authors.rake' - 'lib/tasks/subscribe_old_changesets.rake' - - 'lib/tasks/testing.rake' -# Offense count: 558 +# Offense count: 597 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Enabled: false -# Offense count: 54 +# Offense count: 73 # Cop supports --auto-correct. # Configuration parameters: Strict. Style/NumericLiterals: diff --git a/FAQ.md b/FAQ.md index fd5535975..4ed5df7c4 100644 --- a/FAQ.md +++ b/FAQ.md @@ -5,10 +5,11 @@ promote a large OpenStreetMap focused conference or host a worldwide donation drive. This is a great way to reach a lot of people! 1. Please review the Operations Working Group's [Banner Policy](https://operations.osmfoundation.org/policies/banner/) to know whether your event qualifies for a front-page banner. -2. Create the banner image. Some guidelines: - * Image should be 350px wide (exactly) x 350px tall (or shorter). - * Use a standard web image format (.gif, .jpg, .png) - * Note that a close 'X' button will be drawn over the top right 60x60px corner of the banner, so please do not put anything important in that space. +2. Create the banner image. The image needs to: + * be exactly 350px wide and at most 350px tall, + * be in PNG format, + * have nothing important in the top-right 60x60px corner of the banner which has a close 'X' button overlayed, and + * have sufficient visual contrast with the colours #cccccc and #999999 so the 'X' can be seen. 3. Prepare a pull request which includes the following: * The banner should be saved under the [`app/assets/images/banners/`](https://github.com/openstreetmap/openstreetmap-website/tree/master/app/assets/images/banners) folder, and should have a name that makes it clear what it is for (e.g. `donate-2017.jpg`) * Edit [`config/banners.yml`](https://github.com/openstreetmap/openstreetmap-website/blob/master/config/banners.yml) to contain an entry for the event banner. It should contain the following: @@ -18,6 +19,7 @@ drive. This is a great way to reach a lot of people! * `img` - the filename for the banner image (e.g. `banners/donate-2017.jpg`) * `enddate` - the final date that the banner will be shown (e.g. `2017-oct-31`) * (optional) Feel free to cleanup the old images from the `app/assets/images/banners/` folder and old entries in the `config/banners.yml` file. +4. The pull request must indicate when the banner should start being shown, which must be at least 7 days after the pull request was created. See [PR #1296](https://github.com/openstreetmap/openstreetmap-website/pull/1296) as an example. diff --git a/Gemfile.lock b/Gemfile.lock index 6325485ff..932435b34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,7 +53,7 @@ GEM activerecord (6.1.4) activemodel (= 6.1.4) activesupport (= 6.1.4) - activerecord-import (1.1.0) + activerecord-import (1.2.0) activerecord (>= 3.2) activestorage (6.1.4) actionpack (= 6.1.4) @@ -68,7 +68,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) annotate (3.1.1) activerecord (>= 3.2, < 7.0) @@ -77,8 +77,8 @@ GEM autoprefixer-rails (10.2.5.1) execjs (> 0) aws-eventstream (1.1.1) - aws-partitions (1.471.0) - aws-sdk-core (3.115.0) + aws-partitions (1.479.0) + aws-sdk-core (3.117.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) @@ -90,7 +90,7 @@ GEM aws-sdk-core (~> 3, >= 3.112.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.3) + aws-sigv4 (1.2.4) aws-eventstream (~> 1, >= 1.0.2) better_errors (2.9.1) coderay (>= 1.0.0) @@ -115,7 +115,7 @@ GEM bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) - brakeman (5.0.4) + brakeman (5.1.1) browser (5.3.1) builder (3.2.4) bzip2-ffi (1.1.0) @@ -161,15 +161,15 @@ GEM dry-container (0.8.0) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.6.0) + dry-core (0.7.1) concurrent-ruby (~> 1.0) dry-equalizer (0.3.0) - dry-inflector (0.2.0) + dry-inflector (0.2.1) dry-initializer (3.0.4) dry-logic (1.2.0) concurrent-ruby (~> 1.0) dry-core (~> 0.5, >= 0.5) - dry-schema (1.6.2) + dry-schema (1.7.0) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) dry-core (~> 0.5, >= 0.5) @@ -205,19 +205,23 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (1.4.3) + faraday (1.5.1) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0.1) faraday-net_http (~> 1.0) faraday-net_http_persistent (~> 1.1) + faraday-patron (~> 1.0) multipart-post (>= 1.2, < 3) ruby2_keywords (>= 0.0.4) faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) + faraday-httpclient (1.0.1) faraday-net_http (1.0.1) - faraday-net_http_persistent (1.1.0) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) ffi (1.15.3) ffi-libarchive (1.0.17) ffi (~> 1.0) @@ -248,7 +252,7 @@ GEM image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - image_size (2.1.0) + image_size (2.1.1) in_threads (1.5.4) jbuilder (2.11.2) activesupport (>= 5.0.0) @@ -337,7 +341,7 @@ GEM omniauth-oauth2 (~> 1.4) openstreetmap-deadlock_retry (1.3.1) parallel (1.20.1) - parser (3.0.1.1) + parser (3.0.2.0) ast (~> 2.4.1) pg (1.2.3) popper_js (1.16.0) @@ -393,7 +397,7 @@ GEM rake (>= 0.13) thor (~> 1.0) rainbow (3.0.0) - rake (13.0.3) + rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) @@ -403,7 +407,7 @@ GEM rexml (3.2.5) rinku (2.0.6) rotp (6.2.0) - rubocop (1.17.0) + rubocop (1.18.3) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -412,25 +416,25 @@ GEM rubocop-ast (>= 1.7.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.7.0) + rubocop-ast (1.8.0) parser (>= 3.0.1.1) - rubocop-minitest (0.13.0) + rubocop-minitest (0.14.0) rubocop (>= 0.90, < 2.0) - rubocop-performance (1.11.3) + rubocop-performance (1.11.4) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.11.0) + rubocop-rails (2.11.3) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) - rubocop-rake (0.5.1) - rubocop + rubocop-rake (0.6.0) + rubocop (~> 1.0) ruby-openid (2.9.2) ruby-progressbar (1.11.0) ruby-vips (2.1.2) ffi (~> 1.12) - ruby2_keywords (0.0.4) - rubyzip (2.3.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) sanitize (5.2.3) crass (~> 1.0.2) nokogiri (>= 1.8.0) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 736125bed..3bec5fe36 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -7,15 +7,7 @@ /* Default rules for the body of every page */ body { - font-family: 'Helvetica Neue',Arial,sans-serif; font-size: $typeheight; - line-height: 1.6666; - color: #222; - background-color: #fff; - margin: 0px; - padding: 0px; - text-align: left; - height: 100%; } p > img { @@ -1036,7 +1028,7 @@ tr.turn:hover { .content-inner { position: relative; - max-width: 900px; + max-width: 960px; margin: auto; padding: $lineheight; } @@ -1746,48 +1738,20 @@ div.secondary-actions { background-size: cover; background-attachment: fixed; - .content-inner { - position: relative; - color: #333; - min-width: 320px; - max-width: 640px; - } - - .text { - background: white; - padding: 40px; + max-width: 760px; } .attr { - position: relative; - padding: 170px 40px 20px; - background: #333; - background: rgba(0, 0, 0, .8); - margin-bottom: 0; margin-top: -20px; h1 { - display: block; - color: white; - font-weight: 300; - font-size: 28px; span { color: $vibrant-green; } } - @include media-breakpoint-up(sm) { - h1 { - font-size: 34px; - } - } - .user-image { - position: absolute; - top: 0px; - right: 240px; - left: 0px; height: 150px; background-position: 0 50%; background-repeat: no-repeat; @@ -1797,16 +1761,6 @@ div.secondary-actions { } .byosm { - position: absolute; - top: 0px; - right: 0px; - z-index: 1; - width: 240px; - height: 150px; - padding: 20px 20px 20px 40px; - font: 500 20px/24px Helvetica, Arial, sans-serif; - white-space: nowrap; - color: #fff; background: $vibrant-green; } diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb index babd27c53..7ab7f6835 100644 --- a/app/controllers/oauth_controller.rb +++ b/app/controllers/oauth_controller.rb @@ -27,7 +27,7 @@ class OauthController < ApplicationController any_auth = false @token.client_application.permissions.each do |pref| - if params[pref] + if params[pref].to_i.nonzero? @token.write_attribute(pref, true) any_auth ||= true else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 00d427ac9..3101e5af2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -321,9 +321,9 @@ class UsersController < ApplicationController when "active", "confirmed" successful_login(user, request.env["omniauth.params"]["referer"]) when "suspended" - failed_login t("users.login.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe + failed_login t("sessions.new.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe else - failed_login t("users.login.auth failure") + failed_login t("sessions.new.auth failure") end else redirect_to :action => "new", :nickname => name, :email => email, diff --git a/app/models/acl.rb b/app/models/acl.rb index 90dd7f3cf..a65c3a35a 100644 --- a/app/models/acl.rb +++ b/app/models/acl.rb @@ -23,7 +23,15 @@ class Acl < ApplicationRecord def self.match(address, options = {}) acls = Acl.where("address >>= ?", address) - acls = acls.or(Acl.where(:domain => options[:domain])) if options[:domain] + if options[:domain] + labels = options[:domain].split(".") + + until labels.empty? + acls = acls.or(Acl.where(:domain => labels.join("."))) + labels.shift + end + end + acls = acls.or(Acl.where(:mx => options[:mx])) if options[:mx] acls diff --git a/app/views/messages/inbox.html.erb b/app/views/messages/inbox.html.erb index a27d7f15c..4f2925b14 100644 --- a/app/views/messages/inbox.html.erb +++ b/app/views/messages/inbox.html.erb @@ -2,8 +2,11 @@ <%= javascript_include_tag "messages" %> <% end %> +<% content_for :heading_class, "pb-0" %> + <% content_for :heading do %> -