Do not use the form for the owner property.

Only add the owner property to defaultProperties, if there is a user.  In other words the user can use the map without logging in.
This commit is contained in:
Brian DeRocher 2023-09-20 10:51:01 -04:00
parent 9c89c50560
commit e2b789e575
2 changed files with 7 additions and 4 deletions

View file

@ -1565,7 +1565,11 @@ L.U.Editable = L.Editable.extend({
},
_getDefaultProperties: function() {
return { geojson: { properties: { owner: this.map.options.user.id } } }
const result = {}
if (this.map.options.hasOwnProperty('user')) {
result.geojson = { properties: { owner: this.map.options.user.id } }
}
return result
},
connectCreatedToMap: function (layer) {

View file

@ -105,15 +105,14 @@ L.U.FeatureMixin = {
let property
for (let i = 0; i < this.datalayer._propertiesIndex.length; i++) {
property = this.datalayer._propertiesIndex[i]
if (L.Util.indexOf(['name', 'description', 'owner'], property) !== -1) {
if (L.Util.indexOf(['name', 'description'], property) !== -1) {
continue
}
properties.push([`properties.${property}`, { label: property }])
}
// We always want name, description, owner for now (properties management to come)
// We always want name and description for now (properties management to come)
properties.unshift('properties.description')
properties.unshift('properties.name')
properties.unshift('properties.owner')
builder = new L.U.FormBuilder(this, properties, {
id: 'umap-feature-properties',
callback: this._redraw, // In case we have dynamic options…