Fix storing the Geocoding results (#5664)
authorOlaf Braun <info@braun-development.de>
Wed, 27 Sep 2023 14:13:37 +0000 (16:13 +0200)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2023 14:13:37 +0000 (16:13 +0200)
This was broken due to a typo in the name of the data-* attribute (`googleMapsGeocdingStore`).

Co-authored-by: Tim Düsterhus <duesterhus@woltlab.com>
ts/WoltLabSuite/Core/Component/GoogleMaps/Geocoding.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/GoogleMaps/Geocoding.js

index 522b57d24ef389fe3e5dc0293443e9bca2f4bf4c..3a85783a3634b3bd8f601216ba9c4db1a305b101 100644 (file)
@@ -115,8 +115,9 @@ class Geocoding {
     this.#element.dataset.googleMapsLat = lat.toString();
     this.#element.dataset.googleMapsLng = lng.toString();
 
-    if (this.#element.hasAttribute("data-google-maps-geocoding-store") && this.#element.form) {
-      this.#store(this.#element.dataset.googleMapsGeocdingStore || "", lat, lng);
+    const prefix = this.#element.dataset.googleMapsGeocodingStore;
+    if (prefix != null && this.#element.form) {
+      this.#store(prefix, lat, lng);
     }
   }
 
index b9486c3de139ad8fdb7d0b5f4096fa4a6ec24ec8..386f608c4efcb4b0e0c6c75364cb8d4008cd4dee 100644 (file)
@@ -84,8 +84,9 @@ define(["require", "exports", "../../Helper/Selector", "./Geocoding/Suggestion",
         #setLocation(lat, lng) {
             this.#element.dataset.googleMapsLat = lat.toString();
             this.#element.dataset.googleMapsLng = lng.toString();
-            if (this.#element.hasAttribute("data-google-maps-geocoding-store") && this.#element.form) {
-                this.#store(this.#element.dataset.googleMapsGeocdingStore || "", lat, lng);
+            const prefix = this.#element.dataset.googleMapsGeocodingStore;
+            if (prefix != null && this.#element.form) {
+                this.#store(prefix, lat, lng);
             }
         }
         #store(prefix, lat, lng) {