Set the map option. No need for setting boolean from query string.

Only add the owner property if the feature flag (map.options.featuresHaveOwner) is enabled.

Default to features do NOT have owners.
This commit is contained in:
Brian DeRocher 2023-09-20 13:16:52 -04:00
parent 77b56623ed
commit 6720f76d85
4 changed files with 4 additions and 4 deletions

View file

@ -249,7 +249,7 @@ DATABASES = {
}
UMAP_DEFAULT_SHARE_STATUS = None
UMAP_DEFAULT_EDIT_STATUS = None
UMAP_DEFAULT_FEATURES_HAVE_OWNERS = True
UMAP_DEFAULT_FEATURES_HAVE_OWNERS = False
UMAP_READONLY = env('UMAP_READONLY', default=False)
UMAP_GZIP = True

View file

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

View file

@ -46,6 +46,7 @@ L.Map.mergeOptions({
easing: false,
permissions: {},
permanentCreditBackground: true,
featuresHaveOwner: false,
})
L.U.Map.include({
@ -108,7 +109,6 @@ L.U.Map.include({
L.Util.setBooleanFromQueryString(this.options, 'displayCaptionOnLoad')
L.Util.setBooleanFromQueryString(this.options, 'captionBar')
L.Util.setBooleanFromQueryString(this.options, 'captionMenus')
L.Util.setBooleanFromQueryString(this.options, 'featuresHaveOwners')
for (let i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
L.Util.setNullableBooleanFromQueryString(
this.options,

View file

@ -460,7 +460,7 @@ class MapDetailMixin:
(i, str(label)) for i, label in AnonymousMapPermissionsForm.STATUS
],
"umap_version": VERSION,
"featuresHaveOwners": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS,
"featuresHaveOwner": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS,
}
if self.get_short_url():
properties["shortUrl"] = self.get_short_url()