Merge branch 'next-minor' into develop

This commit is contained in:
Jonne Haß 2021-04-11 01:46:52 +02:00
commit e0af180c9b
5 changed files with 23 additions and 37 deletions

View file

@ -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)

View file

@ -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 &copy; <a href='https://openstreetmap.org'>OpenStreetMap</a> contributors, " +
"<a href='https://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>, " +
"Imagery © <a href='https://www.mapbox.com'>Mapbox</a>",
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 &copy; <a href='https://openstreetmap.org'>OpenStreetMap</a> contributors, " +
"<a href='http://opendatacommons.org/licenses/dbcl/1.0/'>Open Database License, ODbL 1.0</a>, " +
"Imagery © <a href='https://www.mapbox.com'>Mapbox</a>",
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 &copy; <a href='https://openstreetmap.org'>OpenStreetMap</a> contributors, " +
"rendering <a href='http://giscience.uni-hd.de/'>" +
"GIScience Research Group @ Heidelberg University</a>",
maxZoom: 18
});
}
};
})();

View file

@ -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);

View file

@ -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]

View file

@ -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/");
});
});
});