From: Anton Khorev Date: Sat, 18 Jan 2025 15:23:51 +0000 (+0300) Subject: Merge branch 'pull/5512' X-Git-Tag: live~410 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2074e9dce23e1e6380c6c995a79a76671323c905?hp=42d622b735a8f7ef9399e1dae54eb653d08ef112 Merge branch 'pull/5512' --- diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index e0c2ee60b..7929ea0ac 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -32,6 +32,8 @@ L.OSM.Map = L.Map.extend({ layerOptions.apikey = OSM[value]; } else if (property === "leafletOsmId") { layerConstructor = L.OSM[value]; + } else if (property === "leafletOsmDarkId" && OSM.isDarkMap() && L.OSM[value]) { + layerConstructor = L.OSM[value]; } else { layerOptions[property] = value; } @@ -386,6 +388,14 @@ L.extend(L.Icon.Default.prototype, { } }); +OSM.isDarkMap = function () { + var mapTheme = $("body").attr("data-map-theme"); + if (mapTheme) return mapTheme === "dark"; + var siteTheme = $("html").attr("data-bs-theme"); + if (siteTheme) return siteTheme === "dark"; + return window.matchMedia("(prefers-color-scheme: dark)").matches; +}; + OSM.getUserIcon = function (url) { return L.icon({ iconUrl: url || OSM.MARKER_RED, diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 9ce6aec34..098370689 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -9,7 +9,7 @@ body { font-size: $typeheight; - --dark-mode-map-filter: brightness(.8); + --dark-mode-map-filter: none; } time[title] { diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index 16f109c9f..7a10b12e3 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -29,19 +29,6 @@ (" target="_new"><%= t ".openid.link text" %>) -
- - - <% if current_user.data_public? %> - <%= t ".public editing.enabled" %> - (" target="_new"><%= t ".public editing.enabled link text" %>) - <% else %> - <%= t ".public editing.disabled" %> - (<%= t ".public editing.disabled link text" %>) - <% end %> - -
-
diff --git a/config/layers.yml b/config/layers.yml index 98ef2e691..30cf29d29 100644 --- a/config/layers.yml +++ b/config/layers.yml @@ -39,6 +39,7 @@ href: "https://www.thunderforest.com/" - leafletOsmId: "TransportMap" + leafletOsmDarkId: "TransportDarkMap" code: "T" layerId: "transportmap" nameId: "transport_map" diff --git a/config/locales/en.yml b/config/locales/en.yml index 510ee218c..a112f3b0d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -251,13 +251,6 @@ en: openid: link: "https://wiki.openstreetmap.org/wiki/OpenID" link text: "what is this?" - public editing: - heading: "Public editing" - enabled: "Enabled. Not anonymous and can edit data." - enabled link: "https://wiki.openstreetmap.org/wiki/Anonymous_edits" - enabled link text: "what is this?" - disabled: "Disabled and cannot edit data, all previous edits are anonymous." - disabled link text: "why can't I edit?" contributor terms: heading: "Contributor Terms" agreed: "You have agreed to the new Contributor Terms." diff --git a/db/migrate/20250105154621_validate_foreign_key_on_notes.rb b/db/migrate/20250105154621_validate_foreign_key_on_notes.rb new file mode 100644 index 000000000..8ff7df9e9 --- /dev/null +++ b/db/migrate/20250105154621_validate_foreign_key_on_notes.rb @@ -0,0 +1,5 @@ +class ValidateForeignKeyOnNotes < ActiveRecord::Migration[7.2] + def change + validate_foreign_key :notes, :users + end +end diff --git a/db/structure.sql b/db/structure.sql index fe0b4e481..04b0dc17f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3218,7 +3218,7 @@ ALTER TABLE ONLY public.note_comments -- ALTER TABLE ONLY public.notes - ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) NOT VALID; + ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); -- @@ -3408,6 +3408,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('23'), ('22'), ('21'), +('20250105154621'), ('20250104140952'), ('20241023004427'), ('20241022141247'),