diff --git a/Changelog.md b/Changelog.md index 4921679c3..4bab3181c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -44,6 +44,7 @@ Although the chat was never enabled per default and was marked as experimental, * Link diaspora only poduptime list [#8174](https://github.com/diaspora/diaspora/pull/8174) * Delete a user's invitation code during account deletion [#8202](https://github.com/diaspora/diaspora/pull/8202) * Bump mimemagic [#8231](https://github.com/diaspora/diaspora/pull/8231) +* Removed support for defunct Uni Heidelberg OSM tile server, Mapbox is now required if you want to show maps [#8215](https://github.com/diaspora/diaspora/pull/8215) ## Features * Support and recommend TOML as configuration format [#8132](https://github.com/diaspora/diaspora/pull/8132) diff --git a/app/assets/javascripts/app/helpers/locations.js b/app/assets/javascripts/app/helpers/locations.js index df7bb5009..b9f32a00b 100644 --- a/app/assets/javascripts/app/helpers/locations.js +++ b/app/assets/javascripts/app/helpers/locations.js @@ -3,23 +3,21 @@ getTiles: function() { // If the mapbox option is enabled in the diaspora.toml, the mapbox tiles with the podmin's credentials are used. if (gon.appConfig.map.mapbox.enabled) { - return L.tileLayer("https://api.mapbox.com/styles/v1/{style}/tiles/256/{z}/{x}/{y}?access_token={accessToken}", { - accessToken: gon.appConfig.map.mapbox.access_token, - style: gon.appConfig.map.mapbox.style, - attribution: "Map data © OpenStreetMap contributors, " + - "CC-BY-SA, " + - "Imagery © Mapbox", - maxZoom: 18 - }); + return L.tileLayer( + "https://api.mapbox.com/styles/v1/{style}/tiles/256/{z}/{x}/{y}?access_token={accessToken}", + { + accessToken: gon.appConfig.map.mapbox.access_token, + style: gon.appConfig.map.mapbox.style, + attribution: + "Map data © OpenStreetMap contributors, " + + "Open Database License, ODbL 1.0, " + + "Imagery © Mapbox", + maxZoom: 18, + tileSize: 512, + zoomOffset: -1 + } + ); } - - // maptiles from the Heidelberg University are used by default. - return L.tileLayer("http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}", { - attribution: "Map data © OpenStreetMap contributors, " + - "rendering " + - "GIScience Research Group @ Heidelberg University", - maxZoom: 18 - }); } }; })(); diff --git a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js index c58cf08af..35ef61ca7 100644 --- a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js +++ b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js @@ -36,8 +36,9 @@ app.views.SinglePostContent = app.views.Base.extend({ var map = L.map(mapContainer[0]).setView([location.lat, location.lng], 14); var tiles = app.helpers.locations.getTiles(); - - tiles.addTo(map); + if (tiles) { + tiles.addTo(map); + } // put marker on map L.marker(location).addTo(map); diff --git a/config/diaspora.toml.example b/config/diaspora.toml.example index c2373edcd..bdd5ec391 100644 --- a/config/diaspora.toml.example +++ b/config/diaspora.toml.example @@ -198,10 +198,9 @@ ## increase environment.sidekiq.concurrency instead! #sidekiq_workers = 1 -## Displays the location of a post in a map. Per default we are using the map -## tiles of the Heidelberg University (http://giscience.uni-hd.de). -## You also have the possibility to use the map tiles of https://www.mapbox.com -## which is probably more reliable. There you have to create an account to get +## Displays the location of a post in a map. +## If you enable this setting you use the map tiles of https://www.mapbox.com +## which is reliable. There you have to create an account to get ## an access token which is limited. If you want to get an unlimited account ## you can write an email to team@diasporafoundation.org. ## Please enable mapbox and fill out your access_token. @@ -209,7 +208,7 @@ #enabled = false #access_token = "youraccesstoken" -#style = "mapbox/streets-v9" +#style = "mapbox/streets-v11" ## Settings potentially affecting the privacy of your users. [configuration.privacy] diff --git a/spec/javascripts/app/helpers/locations_spec.js b/spec/javascripts/app/helpers/locations_spec.js index 80d66f67d..63d0bd921 100644 --- a/spec/javascripts/app/helpers/locations_spec.js +++ b/spec/javascripts/app/helpers/locations_spec.js @@ -1,28 +1,15 @@ describe("app.helpers.locations", function() { describe("getTiles", function() { - context("with mapbox disabled", function() { - beforeEach(function() { - gon.appConfig = {map: {mapbox: {enabled: false}}}; - }); - - it("returns tiles from the Heidelberg University", function() { - var tiles = app.helpers.locations.getTiles(); - expect(tiles._url).toMatch("http://korona.geog.uni-heidelberg.de/"); - expect(tiles._url).not.toMatch("https://api.tiles.mapbox.com/"); - }); - }); - context("with mapbox enabled", function() { beforeEach(function() { /* eslint-disable camelcase */ - gon.appConfig = {map: {mapbox: {enabled: true, style: "mapbox/streets-v9", access_token: "yourAccessToken"}}}; + gon.appConfig = {map: {mapbox: {enabled: true, style: "mapbox/streets-v11", access_token: "yourAccessToken"}}}; /* eslint-enable camelcase */ }); it("returns tiles from mapbox", function() { var tiles = app.helpers.locations.getTiles(); expect(tiles._url).toMatch("https://api.mapbox.com/"); - expect(tiles._url).not.toMatch("http://korona.geog.uni-heidelberg.de/"); }); }); });