Expose correct edit statuses in anonymous mode

This commit is contained in:
Yohan Boniface 2023-09-08 17:14:37 +02:00
parent e06da18f1e
commit e52b40807a

View file

@ -457,15 +457,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()