]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'pull/5512'
authorAnton Khorev <tony29@yandex.ru>
Sat, 18 Jan 2025 15:23:51 +0000 (18:23 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 18 Jan 2025 15:23:51 +0000 (18:23 +0300)
app/assets/javascripts/leaflet.map.js
app/assets/stylesheets/common.scss
app/views/accounts/edit.html.erb
config/layers.yml
config/locales/en.yml
db/migrate/20250105154621_validate_foreign_key_on_notes.rb [new file with mode: 0644]
db/structure.sql

index e0c2ee60b47fb0ddd5251ac520b3c8e234f8ebca..7929ea0ac7f33545f34c2a73de64150b1ed0f231 100644 (file)
@@ -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,
index 9ce6aec3439542d7f213ab62faaee26222308b6d..098370689a0ec29215550527b4c08f0f58352a13 100644 (file)
@@ -9,7 +9,7 @@
 
 body {
   font-size: $typeheight;
-  --dark-mode-map-filter: brightness(.8);
+  --dark-mode-map-filter: none;
 }
 
 time[title] {
index 16f109c9f99b77d23ced80ae371be78bae461c4d..7a10b12e3d281c181248d9bd5b11312eea62c7b0 100644 (file)
     <small class="form-text text-body-secondary">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</small>
   </fieldset>
 
-  <div class="mb-3">
-    <label class="form-label"><%= t ".public editing.heading" %></label>
-    <span class="form-text text-body-secondary">
-      <% if current_user.data_public? %>
-        <%= t ".public editing.enabled" %>
-        (<a href="<%= t ".public editing.enabled link" %>" target="_new"><%= t ".public editing.enabled link text" %></a>)
-      <% else %>
-        <%= t ".public editing.disabled" %>
-        (<a href="#public"><%= t ".public editing.disabled link text" %></a>)
-      <% end %>
-    </span>
-  </div>
-
   <div class="mb-3">
     <label class="form-label"><%= t ".contributor terms.heading" %></label>
     <span class="form-text text-body-secondary">
index 98ef2e691557d3264a9eed129345ad092d310c18..30cf29d2988cd4b41a0648cea783736e88cccc2e 100644 (file)
@@ -39,6 +39,7 @@
         href: "https://www.thunderforest.com/"
 
 - leafletOsmId: "TransportMap"
+  leafletOsmDarkId: "TransportDarkMap"
   code: "T"
   layerId: "transportmap"
   nameId: "transport_map"
index 510ee218c0acdc4fe924a55e43fe0dd75a7b339b..a112f3b0dee17d495fc794888118f392c0b76b39 100644 (file)
@@ -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 (file)
index 0000000..8ff7df9
--- /dev/null
@@ -0,0 +1,5 @@
+class ValidateForeignKeyOnNotes < ActiveRecord::Migration[7.2]
+  def change
+    validate_foreign_key :notes, :users
+  end
+end
index fe0b4e481ae00779b100be603fb7c3f0aff59085..04b0dc17f13128dc12d1d7982a141243a1fe16e2 100644 (file)
@@ -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'),