diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php
index 820e01b994..f4725c2abe 100644
--- a/app/Http/Middleware/SecureHeaders.php
+++ b/app/Http/Middleware/SecureHeaders.php
@@ -58,7 +58,7 @@ class SecureHeaders
"base-uri 'self'",
"font-src 'self' data:",
"connect-src 'self'",
- sprintf("img-src 'self' data: https://api.tiles.mapbox.com %s", $trackingScriptSrc),
+ sprintf("img-src 'self' data: https://a.tile.openstreetmap.org https://b.tile.openstreetmap.org https://c.tile.openstreetmap.org https://api.tiles.mapbox.com %s", $trackingScriptSrc),
"manifest-src 'self'",
];
diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php
index 670e48ab05..ca6e9227c1 100644
--- a/app/Http/Requests/Request.php
+++ b/app/Http/Requests/Request.php
@@ -297,8 +297,9 @@ class Request extends FormRequest
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
$hasLocationKey = $this->getLocationKey($prefix, 'has_location');
+ $hasLocation = $this->boolean($hasLocationKey);
- // for a POST (store, all fields must be present and accounted for:
+ // for a POST (store), all fields must be present and accounted for:
if (
('POST' === $this->method() && $this->routeIs('*.store'))
&& ($this->has($longitudeKey) && $this->has($latitudeKey) && $this->has($zoomLevelKey))
@@ -322,12 +323,14 @@ class Request extends FormRequest
$data['latitude'] = $this->nullableString($latitudeKey);
$data['zoom_level'] = $this->nullableString($zoomLevelKey);
}
- if (null === $data['longitude'] || null === $data['latitude'] || null === $data['zoom_level']) {
- Log::debug('One of the fields is NULL, wont save.');
+ if (false === $hasLocation || null === $data['longitude'] || null === $data['latitude'] || null === $data['zoom_level']) {
+ Log::debug('One of the fields is NULL or hasLocation is false, wont save.');
$data['store_location'] = false;
- $data['update_location'] = false;
+ $data['update_location'] = true; // update is always true, but the values are null:
+ $data['longitude'] = null;
+ $data['latitude'] = null;
+ $data['zoom_level'] = null;
}
-
Log::debug(sprintf('Returning longitude: "%s", latitude: "%s", zoom level: "%s"', $data['longitude'], $data['latitude'], $data['zoom_level']));
return $data;
diff --git a/public/v1/js/ff/accounts/show.js b/public/v1/js/ff/accounts/show.js
index 509b42ce5a..ae2fa13ee6 100644
--- a/public/v1/js/ff/accounts/show.js
+++ b/public/v1/js/ff/accounts/show.js
@@ -84,10 +84,10 @@ $(function () {
dragging: false
}).setView([latitude, longitude], zoomLevel);
- L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
- attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?access_token={accessToken}', {
+ attribution: '© OpenStreetMap contributors',
maxZoom: 18,
- id: 'mapbox.streets',
+ id: 'mapbox/streets-v11',
accessToken: mapboxToken
}).addTo(mymap);
L.marker([latitude, longitude]).addTo(mymap);
diff --git a/public/v1/js/ff/tags/show.js b/public/v1/js/ff/tags/show.js
index 4f9ff7d401..4a279c5d60 100644
--- a/public/v1/js/ff/tags/show.js
+++ b/public/v1/js/ff/tags/show.js
@@ -40,10 +40,10 @@ $(function () {
dragging: false
}).setView([latitude, longitude], zoomLevel);
- L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
- attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?access_token={accessToken}', {
+ attribution: '© OpenStreetMap contributors',
maxZoom: 18,
- id: 'mapbox.streets',
+ id: 'mapbox/streets-v11',
accessToken: mapboxToken
}).addTo(mymap);
L.marker([latitude, longitude]).addTo(mymap);
diff --git a/resources/views/v1/form/location.twig b/resources/views/v1/form/location.twig
index fc05436cee..98f97c6e24 100644
--- a/resources/views/v1/form/location.twig
+++ b/resources/views/v1/form/location.twig
@@ -111,8 +111,8 @@
// make map:
mymap = L.map('{{ name }}_map').setView({lat: locations.{{ name }}.latitude, lng: locations.{{ name }}.longitude}, locations.{{ name }}.zoom_level);
- L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
- attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?access_token={accessToken}', {
+ attribution: '© OpenStreetMap contributors',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: mapboxToken