From 6720f76d85b45d36abdb0799af85b0999ef63da0 Mon Sep 17 00:00:00 2001 From: Brian DeRocher Date: Wed, 20 Sep 2023 13:16:52 -0400 Subject: [PATCH] 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. --- umap/settings/base.py | 2 +- umap/static/umap/js/umap.controls.js | 2 +- umap/static/umap/js/umap.js | 2 +- umap/views.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/umap/settings/base.py b/umap/settings/base.py index 86b50fe1..b532fe43 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -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 diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index b0c01c2a..820252bf 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -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 diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 4ba5fe14..325e071c 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -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, diff --git a/umap/views.py b/umap/views.py index 31f86717..9a142f4c 100644 --- a/umap/views.py +++ b/umap/views.py @@ -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()