Merge pull request #1324 from openbrian/add-username-to-features
Add username to features
This commit is contained in:
commit
27e8fd0cac
4 changed files with 14 additions and 4 deletions
|
@ -250,6 +250,7 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
UMAP_DEFAULT_SHARE_STATUS = None
|
UMAP_DEFAULT_SHARE_STATUS = None
|
||||||
UMAP_DEFAULT_EDIT_STATUS = None
|
UMAP_DEFAULT_EDIT_STATUS = None
|
||||||
|
UMAP_DEFAULT_FEATURES_HAVE_OWNERS = False
|
||||||
|
|
||||||
UMAP_READONLY = env('UMAP_READONLY', default=False)
|
UMAP_READONLY = env('UMAP_READONLY', default=False)
|
||||||
UMAP_GZIP = True
|
UMAP_GZIP = True
|
||||||
|
|
|
@ -1565,16 +1565,23 @@ L.U.Editable = L.Editable.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
createPolyline: function (latlngs) {
|
createPolyline: function (latlngs) {
|
||||||
return new L.U.Polyline(this.map, latlngs)
|
return new L.U.Polyline(this.map, latlngs, this._getDefaultProperties())
|
||||||
},
|
},
|
||||||
|
|
||||||
createPolygon: function (latlngs) {
|
createPolygon: function (latlngs) {
|
||||||
const polygon = new L.U.Polygon(this.map, latlngs)
|
return new L.U.Polygon(this.map, latlngs, this._getDefaultProperties())
|
||||||
return polygon
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createMarker: function (latlng) {
|
createMarker: function (latlng) {
|
||||||
return new L.U.Marker(this.map, latlng)
|
return new L.U.Marker(this.map, latlng, this._getDefaultProperties())
|
||||||
|
},
|
||||||
|
|
||||||
|
_getDefaultProperties: function() {
|
||||||
|
const result = {}
|
||||||
|
if (this.map.options.featuresHaveOwner && this.map.options.hasOwnProperty('user')) {
|
||||||
|
result.geojson = { properties: { owner: this.map.options.user.id } }
|
||||||
|
}
|
||||||
|
return result
|
||||||
},
|
},
|
||||||
|
|
||||||
connectCreatedToMap: function (layer) {
|
connectCreatedToMap: function (layer) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ L.Map.mergeOptions({
|
||||||
easing: false,
|
easing: false,
|
||||||
permissions: {},
|
permissions: {},
|
||||||
permanentCreditBackground: true,
|
permanentCreditBackground: true,
|
||||||
|
featuresHaveOwner: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
L.U.Map.include({
|
L.U.Map.include({
|
||||||
|
|
|
@ -460,6 +460,7 @@ class MapDetailMixin:
|
||||||
(i, str(label)) for i, label in Map.SHARE_STATUS if i != Map.BLOCKED
|
(i, str(label)) for i, label in Map.SHARE_STATUS if i != Map.BLOCKED
|
||||||
],
|
],
|
||||||
"umap_version": VERSION,
|
"umap_version": VERSION,
|
||||||
|
"featuresHaveOwner": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS,
|
||||||
}
|
}
|
||||||
created = bool(getattr(self, "object", None))
|
created = bool(getattr(self, "object", None))
|
||||||
if (created and self.object.owner) or (not created and not user.is_anonymous):
|
if (created and self.object.owner) or (not created and not user.is_anonymous):
|
||||||
|
|
Loading…
Reference in a new issue