From f41037cafd15175569e853339764b04a28333508 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 8 Sep 2023 17:14:37 +0200 Subject: [PATCH] Expose correct edit statuses in anonymous mode --- umap/views.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/umap/views.py b/umap/views.py index 9759a24d..e74c0789 100644 --- a/umap/views.py +++ b/umap/views.py @@ -456,15 +456,19 @@ class MapDetailMixin: "umap_id": self.get_umap_id(), "starred": self.is_starred(), "licences": dict((l.name, l.json) for l in Licence.objects.all()), - "edit_statuses": [(i, str(label)) for i, label in Map.EDIT_STATUS], "share_statuses": [ (i, str(label)) for i, label in Map.SHARE_STATUS if i != Map.BLOCKED ], - "anonymous_edit_statuses": [ - (i, str(label)) for i, label in AnonymousDataLayerPermissionsForm.STATUS - ], "umap_version": VERSION, } + if self.object.owner: + properties["edit_statuses"] = [ + (i, str(label)) for i, label in Map.EDIT_STATUS + ] + else: + properties["edit_statuses"] = [ + (i, str(label)) for i, label in AnonymousDataLayerPermissionsForm.STATUS + ] if self.get_short_url(): properties["shortUrl"] = self.get_short_url()