From: Tom Hughes Date: Wed, 6 Dec 2023 17:47:14 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/4388' X-Git-Tag: live~435 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/77797b21b0701654f9a7ee57aace7fa16214e9c2?hp=6950f44a71f2570bfed7352edb0612c3c0069221 Merge remote-tracking branch 'upstream/pull/4388' --- diff --git a/Gemfile.lock b/Gemfile.lock index ec0ec403f..212cdb73e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,20 +95,20 @@ GEM autoprefixer-rails (10.4.16.0) execjs (~> 2) aws-eventstream (1.3.0) - aws-partitions (1.859.0) - aws-sdk-core (3.188.0) - aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (1.863.0) + aws-sdk-core (3.190.0) + aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.73.0) + aws-sdk-kms (1.74.0) aws-sdk-core (~> 3, >= 3.188.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.140.0) - aws-sdk-core (~> 3, >= 3.188.0) + aws-sdk-s3 (1.141.0) + aws-sdk-core (~> 3, >= 3.189.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.6) - aws-sigv4 (1.7.0) + aws-sigv4 (~> 1.8) + aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) better_errors (2.10.1) @@ -133,7 +133,7 @@ GEM bootstrap_form (5.4.0) actionpack (>= 6.1) activemodel (>= 6.1) - brakeman (6.0.1) + brakeman (6.1.0) brotli (0.4.0) browser (5.3.1) builder (3.2.4) @@ -177,7 +177,7 @@ GEM activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) docile (1.4.0) - doorkeeper (5.6.7) + doorkeeper (5.6.8) railties (>= 5) doorkeeper-i18n (5.2.7) doorkeeper (>= 5.2) @@ -288,7 +288,7 @@ GEM image_size (3.3.0) in_threads (1.6.0) io-console (0.6.0) - irb (1.9.1) + irb (1.10.1) rdoc reline (>= 0.3.8) jbuilder (2.11.5) @@ -299,7 +299,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.6.3) + json (2.7.1) jwt (2.7.1) kgio (2.11.4) kramdown (2.4.0) @@ -334,7 +334,7 @@ GEM multi_json (1.15.0) multi_xml (0.6.0) mutex_m (0.2.0) - net-imap (0.4.6) + net-imap (0.4.7) date net-protocol net-pop (0.1.2) @@ -343,7 +343,7 @@ GEM timeout net-smtp (0.4.0) net-protocol - nio4r (2.6.1) + nio4r (2.7.0) nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -415,7 +415,7 @@ GEM ruby-openid (>= 2.1.8) rack-protection (3.1.0) rack (~> 2.2, >= 2.2.4) - rack-session (1.0.1) + rack-session (1.0.2) rack (< 3) rack-test (2.1.0) rack (>= 1.3) @@ -464,9 +464,9 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.6.0) + rdoc (6.6.1) psych (>= 4.0.0) - regexp_parser (2.8.2) + regexp_parser (2.8.3) reline (0.4.1) io-console (~> 0.5) request_store (1.5.1) @@ -477,7 +477,7 @@ GEM rouge (4.2.0) rtlcss (0.2.1) mini_racer (>= 0.6.3) - rubocop (1.57.2) + rubocop (1.58.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -485,7 +485,7 @@ GEM rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 137de18fd..7f70f4a38 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -72,7 +72,7 @@ class Changeset < ApplicationRecord # note that this may not be a hard limit - due to timing changes and # concurrency it is possible that some changesets may be slightly # longer than strictly allowed or have slightly more changes in them. - ((closed_at > Time.now.utc) && (num_changes <= MAX_ELEMENTS)) + (closed_at > Time.now.utc) && (num_changes <= MAX_ELEMENTS) end def set_closed_time_now diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 7421bd334..fdbf11a2c 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -6,7 +6,7 @@ module OpenStreetMap class Cors < Rack::Cors def call(env) - status, headers, body = super env + status, headers, body = super(env) headers["Cache-Control"] = "no-cache" if headers["Access-Control-Allow-Origin"] [status, headers, body] end diff --git a/config/initializers/oauth.rb b/config/initializers/oauth.rb index 57b89564f..fbe4ad219 100644 --- a/config/initializers/oauth.rb +++ b/config/initializers/oauth.rb @@ -40,12 +40,12 @@ module OpenStreetMap def render(options = {}) text = options.delete(:text) if text - super options.merge(:plain => text) + super(options.merge(:plain => text)) elsif options.delete(:nothing) status = options.delete(:status) || :ok head status, options else - super options + super(options) end end @@ -61,7 +61,7 @@ module OpenStreetMap end end - super controller + super(controller) end end end diff --git a/config/locales/el.yml b/config/locales/el.yml index 338084078..ea8f011e9 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1127,7 +1127,7 @@ el: embankment: Ανάχωμα flagpole: Ιστός σημαίας gasometer: Αεριόμετρο - groyne: Φράγμα + groyne: Κυματοθραύστης kiln: Καμίνι lighthouse: Φάρος manhole: Ανθρωποθυρίδα diff --git a/config/locales/et.yml b/config/locales/et.yml index 38670e7f9..59866c7a1 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1385,7 +1385,7 @@ et: remember: Jäta mind meelde lost password link: Kas unustasid parooli? login_button: Logi sisse - register now: 'Registreeru:' + register now: Registreeru nüüd with external: 'Teise võimalusena võid sisse logida kolmanda osapoole kaudu:' no account: Sa ei ole veel registreerinud kasutajaks? auth failure: Kahjuks ei õnnestu nende andmetega sisse logida. @@ -1563,11 +1563,10 @@ et: Meie kaastöölised on tuhanded üksikisikud. Samuti oleme kaasanud vabalt litsentseeritud andmeid riiklikest kaardistusteenistustest ja muudest allikatest, sealhulgas: - contributors_at_credit_html: '%{austria}: Sisaldab andmeid %{stadt_wien_link} - (%{cc_by_link} tingimustel), %{land_vorarlberg_link} ja Tirooli liidumaast - (%{cc_by_at_with_amendments_link}).' - contributors_at_stadt_wien: Viini linnast - contributors_at_land_vorarlberg: Vorarlbergi liidumaast + contributors_at_credit_html: '%{austria}: Sisaldab %{stadt_wien_link} (%{cc_by_link} + tingimustel), %{land_vorarlberg_link} ja Tirooli liidumaa andmeid (%{cc_by_at_with_amendments_link}).' + contributors_at_stadt_wien: Viini linna + contributors_at_land_vorarlberg: Vorarlbergi liidumaa contributors_at_cc_by_at_with_amendments: CC BY AT tingimustel koos õiendustega contributors_au_credit_html: '%{australia}: Sisaldab halduspiire või on tuletatud halduspiiridest, mille allikas on © %{geoscape_australia_link} ja mille @@ -1599,6 +1598,11 @@ et: contributors_nz_credit_html: '%{new_zealand}: Sisaldab teenuse %{linz_data_service_link} andmeid, mis on kasutatavad litsentsi %{cc_by_link} tingimustel.' contributors_nz_new_zealand: Uus-Meremaa + contributors_rs_credit_html: |- + %{serbia}: Sisaldab andmeid, mis on pärit %{rgz_link} ja %{open_data_portal} + (Serbia avalik teave), 2018. + contributors_rs_rgz: Serbia geodeesiaametist + contributors_rs_open_data_portal: riigi avaandmete portaalist contributors_si_credit_html: '%{slovenia}: Sisaldab %{gu_link} ning %{mkgp_link} andmeid (Sloveenia avalik informatsioon).' contributors_si_slovenia: Sloveenia @@ -2040,6 +2044,7 @@ et: revoke: flash: Oled tühistanud rakenduse %{application} loa. scopes: + openid: Sisse logida kasutades OpenStreetMapi read_prefs: Lugeda kasutajaeelistusi write_prefs: Muuta kasutajaeelistusi write_diary: Luua päeviku sissekandeid, kommenteerida ja lisada sõpru diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9455837ae..8e8ac8620 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -2575,6 +2575,7 @@ fr: automated_edits: Modifications automatisées automated_edits_url: https://wiki.openstreetmap.org/wiki/FR:Code_de_conduite_des_modifications_automatis%C3%A9es start_mapping: Commencer à cartographier + continue_authorization: Continuer l'autorisation add_a_note: title: Pas le temps d’effectuer les modifications ? Ajoutez une note ! para_1: Si vous voulez juste une petite correction et n’avez pas le temps diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 14a79a979..dd0a9b2f5 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -2452,6 +2452,7 @@ gl: imports: importacións automated_edits: edicións automáticas start_mapping: Comezar a cartografar + continue_authorization: Continuar coa autorización add_a_note: title: Non tes tempo para editar? Engade unha nota! para_1: Se soamente queres corrixir unha pequena cousa e non tes tempo de diff --git a/config/locales/he.yml b/config/locales/he.yml index f7880dd95..e5a7c2e03 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -2439,6 +2439,7 @@ he: imports: מחזורי יבוא automated_edits: עריכות אוטומטית start_mapping: להתחיל למפות + continue_authorization: המשך האישור add_a_note: title: אין לך זמן לערוך? אפשר להוסיף הערה! para_1: אם רק רצית לתקן משהו קטן ואין לך זמן להירשם וללמוד איך לערוך, קל להוסיף @@ -3116,6 +3117,7 @@ he: map_data_zoom_in_tooltip: יש לקרב את המפה כדי לראות נתוני מפה queryfeature_tooltip: שאילתת ישויות queryfeature_disabled_tooltip: תקריב כדי להריץ שאילתת ישויות + embed_html_disabled: הטבעת HTML אינה זמינה בשכבת המפה הזאת changesets: show: comment: להגיב diff --git a/config/locales/oc.yml b/config/locales/oc.yml index ed0267bdf..4e5604c50 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -21,7 +21,7 @@ oc: prompt: Seleccionatz un fichier submit: diary_comment: - create: Sauvar + create: Comentari diary_entry: create: Publicar update: Actualizar @@ -103,6 +103,7 @@ oc: diary_entry: user: Utilizaire title: Subjècte + body: Còrs latitude: Latitud longitude: Longitud language_code: Lenga @@ -222,6 +223,7 @@ oc: openid: OpenID google: Google facebook: Facebook + microsoft: Microsoft github: GitHub wikipedia: Wikipèdia api: @@ -237,6 +239,7 @@ oc: reopened_at_by_html: Reactivat fa %{when} per %{user} rss: title: Nòtas d'OpenStreetMap + description_all: Una lista de nòtas denonciadas, comentadas o barradas description_area: Una lista de nòtas, reportadas, comentadas o serradas dins vòstra zòna [(%{min_lat}|%{min_lon}) -- (%{max_lat}|%{max_lon})] description_item: Un fiu rss per la nòta %{id} @@ -271,6 +274,8 @@ oc: retain_changeset_discussions: Lei discussions sus lei cambiaments, se n'i a, se conservaràn. retain_email: L'adreiça e-mail sarà conservada. + recent_editing_html: Coma avètz recentament modificat vòstre compte se pòt + pas suprimir per ara. La supression serà possibla en %{time}. confirm_delete: Siatz segur ? cancel: Anullar accounts: @@ -1247,7 +1252,7 @@ oc: hardware: Quicalhariá health_food: Botiga d'alimentacion naturala hearing_aids: Aparelhs auditius - herbalist: Erboristeria + herbalist: Erbolariá hifi: Botiga Hi-Fi houseware: Venda d’articles per l'ostau ice_cream: Glacier diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 915bd5e3f..0708a3722 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -256,6 +256,7 @@ sl: openid: OpenID google: Google facebook: Facebook + microsoft: Microsoft github: GitHub wikipedia: Wikipedija api: @@ -264,7 +265,7 @@ sl: opened_at_html: Ustvarjeno %{when} opened_at_by_html: Ustvaril_a %{user} %{when} commented_at_html: Posodobljeno %{when} - commented_at_by_html: Posodobil_a %{user} %{when} + commented_at_by_html: Posodobil/a %{user} %{when} closed_at_html: RazreÅ¡eno %{when} closed_at_by_html: RazreÅ¡il_a %{user} %{when} reopened_at_html: Znova aktivirano %{when} @@ -306,6 +307,8 @@ sl: retain_changeset_discussions: Ohranjeni bodo vaÅ¡i pogovori o naborih sprememb, če obstajajo. retain_email: Ohranjen bo vaÅ¡ e-poÅ¡tni naslov. + recent_editing_html: Pred kratkim ste urejali, zato vaÅ¡ega računa trenutno + ni mogoče izbrisati. Brisanje bo mogoče čez %{time}. confirm_delete: Ali ste prepričani? cancel: Prekliči accounts: @@ -500,7 +503,7 @@ sl: index: title: Sklopi sprememb title_user: Sklopi sprememb od %{user} - title_user_link_html: Sklopi sprememb uporabnika_ce %{user_link} + title_user_link_html: Sklopi sprememb uporabnika/ce %{user_link} title_friend: Množice sprememb mojih prijateljev title_nearby: Sklopi sprememb bližnjih uporabnikov empty: Ni najdenih množic sprememb. @@ -515,7 +518,7 @@ sl: changeset_comments: comment: comment: 'Nov komentar o naboru sprememb #%{changeset_id} uporabnika %{author}' - commented_at_by_html: Posodobil_a %{user} %{when} + commented_at_by_html: Posodobil/a %{user} %{when} comments: comment: 'Nov komentar o naboru sprememb #%{changeset_id} uporabnika %{author}' index: @@ -1511,7 +1514,7 @@ sl: no_reports: Ni prijav report_created_at: Prvič prijavljeno %{datetime} last_resolved_at: Zadnjič razreÅ¡eno %{datetime} - last_updated_at: Zadnjič %{datetime} posodobil_a %{displayname} + last_updated_at: Zadnjič %{datetime} posodobil/a %{displayname} resolve: RazreÅ¡i ignore: Prezri reopen: Znova odpri @@ -2484,6 +2487,7 @@ sl: imports_url: https://wiki.openstreetmap.org/wiki/SL:Import/Guidelines automated_edits: Avtomatizirana urejanja start_mapping: Začnite kartirati + continue_authorization: Nadaljuj avtorizacijo add_a_note: title: Nimate časa za urejanje? Dodajte opombo! para_1: Če si želite popraviti kakÅ¡no majhno napako in nimate časa za prijavo @@ -2872,12 +2876,15 @@ sl: role: administrator: Ta uporabnik je administrator moderator: Ta uporabnik je moderator + importer: Ta uporabnik je uvoznik grant: administrator: Podeli administratorski dostop moderator: Podeli moderatorski dostop + importer: Podeli dostop uvoznika revoke: administrator: Odvzemi administratorski dostop moderator: Odvzemi moderatorski dostop + importer: Odvzemi dostop uvoznika block_history: Aktivna blokiranja moderator_history: Izvedena blokiranja comments: Komentarji @@ -3018,11 +3025,11 @@ sl: blocks_on: title: Blokiranja uporabnika %{name} heading_html: Seznam blokiranj uporabnika %{name} - empty: Uporabnik_ca %{name} Å¡e ni bil_a blokiran_a. + empty: Uporabnik/ca %{name} Å¡e ni bil/a blokiran/a. blocks_by: - title: Dana blokiranja uporabnika_ce %{name} + title: Dana blokiranja uporabnika/ce %{name} heading_html: Seznam izvedenih blokiranj uporabnika %{name} - empty: Uporabnik_ca %{name} ni blokiral_a Å¡e nikogar. + empty: Uporabnik/ca %{name} ni blokiral/a Å¡e nikogar. show: title: '%{block_by} je blokiral uporabnika %{block_on}' heading_html: '%{block_by} je blokiral uporabnika %{block_on}' @@ -3182,6 +3189,7 @@ sl: map_data_zoom_in_tooltip: Približajte za ogled podatkov zemljevida queryfeature_tooltip: Preveri značilnosti queryfeature_disabled_tooltip: Približajte za preverjanje značilnosti + embed_html_disabled: Za ta sloj zemljevida vdelava HTML ni na voljo changesets: show: comment: Komentiraj diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 3cc9a4fc3..27d2c67c7 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -2464,6 +2464,7 @@ tr: imports: Aktarımlar automated_edits: Otomatik Düzenlemeler start_mapping: Haritacılığa Başla + continue_authorization: Yetkilendirmeye Devam Et add_a_note: title: Düzenlemek için vaktin yok mu? O zaman bir not ekle! para_1: |- @@ -2857,12 +2858,15 @@ tr: role: administrator: Bu kullanıcı, bir yöneticidir. moderator: Bu kullanıcı, bir moderatördür. + importer: Bu kullanıcı bir ithalatçıdır grant: administrator: Yönetici erişim hakkı moderator: Moderatör erişim izni + importer: Ä°thalatçıya erişim izni ver revoke: administrator: Yönetici erişimini iptal etme moderator: Moderatör erişimini iptal etme + importer: Ä°thalatçı erişimini iptal et block_history: Etkin Engellemeler moderator_history: Verilen Engellemeler comments: Yorumlar diff --git a/config/locales/uk.yml b/config/locales/uk.yml index bbbed993e..e819260b4 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -2496,6 +2496,7 @@ uk: imports: імпортів automated_edits: автоматизованих змін start_mapping: Розпочати мапити + continue_authorization: Продовжити авторизацію add_a_note: title: Немаєте часу, щоб виправити мапу? Додайте нотатку! para_1: Якщо потрібно внести дрібне уточнення, заради якого немає потреби @@ -2888,7 +2889,7 @@ uk: notes: Нотатки remove as friend: Вилучити зі списку друзів add as friend: Додати до списку друзів - mapper since: 'Зареєстрований:' + mapper since: 'Обліковий запис створено:' uid: 'id учасника:' ct status: 'Умови співпраці:' ct undecided: Не визначились @@ -2931,8 +2932,8 @@ uk: showing: one: Сторінка %{page} (%{first_item} з %{items}) other: Сторінка %{page} (%{first_item}-%{last_item} з %{items}) - summary_html: '%{name} зареєстрований з %{ip_address}, %{date}' - summary_no_ip_html: '%{name} зареєстрований %{date}' + summary_html: '%{name} зареєстровано з %{ip_address}, %{date}' + summary_no_ip_html: '%{name} зареєстровано %{date}' confirm: Підтвердити вибір учасників hide: Сховати вибраних учасників empty: Не знайдено учасників відповідно до критеріїв пошуку diff --git a/db/migrate/20120208122334_merge_acl_address_and_mask.rb b/db/migrate/20120208122334_merge_acl_address_and_mask.rb index 09b0ae3b0..5cac10740 100644 --- a/db/migrate/20120208122334_merge_acl_address_and_mask.rb +++ b/db/migrate/20120208122334_merge_acl_address_and_mask.rb @@ -21,7 +21,7 @@ class MergeAclAddressAndMask < ActiveRecord::Migration[4.2] prefix = 0 while netmask != "0.0.0.0" - netmask = netmask << 1 + netmask <<= 1 prefix += 1 end diff --git a/lib/osm.rb b/lib/osm.rb index 905f3ac97..65eab6907 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -8,7 +8,7 @@ module OSM # The base class for API Errors. class APIError < RuntimeError def initialize(message = "Generic API Error") - super message + super(message) end def status @@ -19,7 +19,7 @@ module OSM # Raised when access is denied. class APIAccessDenied < APIError def initialize - super "Access denied" + super("Access denied") end def status @@ -30,7 +30,7 @@ module OSM # Raised when an API object is not found. class APINotFoundError < APIError def initialize - super "Object not found" + super("Object not found") end def status @@ -41,7 +41,7 @@ module OSM # Raised when a precondition to an API action fails sanity check. class APIPreconditionFailedError < APIError def initialize(message = "") - super "Precondition failed: #{message}" + super("Precondition failed: #{message}") end def status @@ -55,7 +55,7 @@ module OSM @object = object @object_id = object_id - super "The #{object} with the id #{object_id} has already been deleted" + super("The #{object} with the id #{object_id} has already been deleted") end attr_reader :object, :object_id @@ -68,7 +68,7 @@ module OSM # Raised when the user logged in isn't the same as the changeset class APIUserChangesetMismatchError < APIError def initialize - super "The user doesn't own that changeset" + super("The user doesn't own that changeset") end def status @@ -81,7 +81,7 @@ module OSM def initialize(changeset) @changeset = changeset - super "The changeset #{changeset.id} was closed at #{changeset.closed_at}" + super("The changeset #{changeset.id} was closed at #{changeset.closed_at}") end attr_reader :changeset @@ -96,7 +96,7 @@ module OSM def initialize(changeset) @changeset = changeset - super "The changeset #{changeset.id} is not yet closed." + super("The changeset #{changeset.id} is not yet closed.") end attr_reader :changeset @@ -111,7 +111,7 @@ module OSM def initialize(changeset) @changeset = changeset - super "You are already subscribed to changeset #{changeset.id}." + super("You are already subscribed to changeset #{changeset.id}.") end attr_reader :changeset @@ -126,7 +126,7 @@ module OSM def initialize(changeset) @changeset = changeset - super "You are not subscribed to changeset #{changeset.id}." + super("You are not subscribed to changeset #{changeset.id}.") end attr_reader :changeset @@ -139,7 +139,7 @@ module OSM # Raised when a change is expecting a changeset, but the changeset doesn't exist class APIChangesetMissingError < APIError def initialize - super "You need to supply a changeset to be able to make a change" + super("You need to supply a changeset to be able to make a change") end def status @@ -151,7 +151,7 @@ module OSM # the changeset ID that the diff was uploaded to. class APIChangesetMismatchError < APIError def initialize(provided, allowed) - super "Changeset mismatch: Provided #{provided} but only #{allowed} is allowed" + super("Changeset mismatch: Provided #{provided} but only #{allowed} is allowed") end def status @@ -163,7 +163,7 @@ module OSM # modify, or delete class APIChangesetActionInvalid < APIError def initialize(provided) - super "Unknown action #{provided}, choices are create, modify, delete" + super("Unknown action #{provided}, choices are create, modify, delete") end def status @@ -175,7 +175,7 @@ module OSM # they should. class APIBadXMLError < APIError def initialize(model, xml, message = "") - super "Cannot parse valid #{model} from xml string #{xml}. #{message}" + super("Cannot parse valid #{model} from xml string #{xml}. #{message}") end def status @@ -191,7 +191,7 @@ module OSM @provided = provided @latest = latest - super "Version mismatch: Provided #{provided}, server had: #{latest} of #{type} #{id}" + super("Version mismatch: Provided #{provided}, server had: #{latest} of #{type} #{id}") end attr_reader :provided, :latest, :id, :type @@ -209,7 +209,7 @@ module OSM @id = id @tag_key = tag_key - super "Element #{type}/#{id} has duplicate tags with key #{tag_key}" + super("Element #{type}/#{id} has duplicate tags with key #{tag_key}") end attr_reader :type, :id, :tag_key @@ -223,7 +223,7 @@ module OSM # This prevents ways from being to long and difficult to work with class APITooManyWayNodesError < APIError def initialize(id, provided, max) - super "You tried to add #{provided} nodes to way #{id}, however only #{max} are allowed" + super("You tried to add #{provided} nodes to way #{id}, however only #{max} are allowed") @id = id @provided = provided @@ -241,7 +241,7 @@ module OSM # This prevents relations from being too complex and difficult to work with class APITooManyRelationMembersError < APIError def initialize(id, provided, max) - super "You tried to add #{provided} members to relation #{id}, however only #{max} are allowed" + super("You tried to add #{provided} members to relation #{id}, however only #{max} are allowed") @id = id @provided = provided @@ -275,7 +275,7 @@ module OSM # raised when an API call is made using a method not supported on that URI class APIBadMethodError < APIError def initialize(supported_method) - super "Only method #{supported_method} is supported on this URI" + super("Only method #{supported_method} is supported on this URI") end def status @@ -287,7 +287,7 @@ module OSM # raised when an API call takes too long class APITimeoutError < APIError def initialize - super "Request timed out" + super("Request timed out") end def status @@ -300,7 +300,7 @@ module OSM # an element - only historical versions can be redacted. class APICannotRedactError < APIError def initialize - super "Cannot redact current version of element, only historical versions may be redacted." + super("Cannot redact current version of element, only historical versions may be redacted.") end def status @@ -313,7 +313,7 @@ module OSM def initialize(note) @note = note - super "The note #{note.id} was closed at #{note.closed_at}" + super("The note #{note.id} was closed at #{note.closed_at}") end attr_reader :note @@ -328,7 +328,7 @@ module OSM def initialize(note) @note = note - super "The note #{note.id} is already open" + super("The note #{note.id} is already open") end attr_reader :note @@ -343,7 +343,7 @@ module OSM def initialize(key) @key = key - super "Duplicate preferences with key #{key}" + super("Duplicate preferences with key #{key}") end attr_reader :key @@ -356,7 +356,7 @@ module OSM # Raised when a rate limit is exceeded class APIRateLimitExceeded < APIError def initialize - super "Rate limit exceeded" + super("Rate limit exceeded") end def status @@ -502,15 +502,8 @@ module OSM end # Construct a random token of a given length - def self.make_token(length = 30) - chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - token = "" - - length.times do - token += chars[(rand * chars.length).to_i].chr - end - - token + def self.make_token(length = 24) + SecureRandom.urlsafe_base64(length) end # Return an SQL fragment to select a given area of the globe diff --git a/test/controllers/changesets_controller_test.rb b/test/controllers/changesets_controller_test.rb index 79fd7a571..d9a4b256b 100644 --- a/test/controllers/changesets_controller_test.rb +++ b/test/controllers/changesets_controller_test.rb @@ -332,7 +332,7 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest assert_select "> entry > content > xhtml|div > xhtml|table" do assert_select "> xhtml|tr > xhtml|td > xhtml|table" do - changeset.tags.each do |key, _| + changeset.tags.each_key do |key| assert_select "> xhtml|tr > xhtml|td", :text => /^#{key} = / end end diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index 2baa6f776..21e751bca 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -206,7 +206,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -359,7 +359,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_openid/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_openid/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -513,7 +513,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_google/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_google/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -665,7 +665,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_facebook/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_facebook/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -817,7 +817,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_microsoft/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_microsoft/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -971,7 +971,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_github/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_github/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end @@ -1125,7 +1125,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_equal register_email.to.first, new_email # Check that the confirm account url is correct - confirm_regex = Regexp.new("/user/redirect_tester_wikipedia/confirm\\?confirm_string=([a-zA-Z0-9]*)") + confirm_regex = Regexp.new("/user/redirect_tester_wikipedia/confirm\\?confirm_string=([a-zA-Z0-9_-]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end diff --git a/test/lib/i18n_test.rb b/test/lib/i18n_test.rb index a25e4887c..8d597fc65 100644 --- a/test/lib/i18n_test.rb +++ b/test/lib/i18n_test.rb @@ -2,7 +2,7 @@ require "test_helper" class I18nTest < ActiveSupport::TestCase I18n.available_locales.each do |locale| - define_method("test_#{locale.to_s.underscore}".to_sym) do + define_method(:"test_#{locale.to_s.underscore}") do without_i18n_exceptions do # plural_keys = plural_keys(locale) @@ -57,7 +57,7 @@ class I18nTest < ActiveSupport::TestCase Rails.root.glob("config/locales/*.yml").each do |filename| lang = File.basename(filename, ".yml") - define_method("test_#{lang}_for_raw_html".to_sym) do + define_method(:"test_#{lang}_for_raw_html") do yml = YAML.load_file(filename) assert_nothing_raised do check_values_for_raw_html(yml)