From 26b3b4b5c7b62edd48fabca55c9d4b572c6d68b0 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 15 Aug 2023 22:36:11 +0200 Subject: [PATCH 1/2] Do not try to display share status until map is created --- umap/static/umap/js/umap.controls.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index fd03a6c0..9f4a3eda 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -983,9 +983,11 @@ L.U.Map.include({ name = L.DomUtil.create('a', 'map-name', container), share_status = L.DomUtil.create('a', 'share-status', container), update = () => { + const status = this.permissions.getShareStatusDisplay() name.textContent = this.getDisplayName() - share_status.textContent = L._('Visibility: {status}', { - status: this.permissions.getShareStatusDisplay(), + // status is not set until map is saved once + if (status) share_status.textContent = L._('Visibility: {status}', { + status: status, }) } update() From 99c02712856480ab27c0b1a6bceac7ab6a8e2e2f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 15 Aug 2023 22:42:58 +0200 Subject: [PATCH 2/2] Update edit header when map has been saved We need to update the share status display at first save --- umap/static/umap/js/umap.controls.js | 1 + 1 file changed, 1 insertion(+) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 9f4a3eda..dd7bb20a 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -991,6 +991,7 @@ L.U.Map.include({ }) } update() + this.once('saved', L.bind(update, this)) name.href = '#' share_status.href = '#' logo.href = '/'