Merge pull request #1260 from umap-project/visibility-at-create

Do not try to display share status until map has been saved once
This commit is contained in:
Yohan Boniface 2023-08-15 23:08:12 +02:00 committed by GitHub
commit d0d1b16413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -983,12 +983,15 @@ L.U.Map.include({
name = L.DomUtil.create('a', 'map-name', container), name = L.DomUtil.create('a', 'map-name', container),
share_status = L.DomUtil.create('a', 'share-status', container), share_status = L.DomUtil.create('a', 'share-status', container),
update = () => { update = () => {
const status = this.permissions.getShareStatusDisplay()
name.textContent = this.getDisplayName() name.textContent = this.getDisplayName()
share_status.textContent = L._('Visibility: {status}', { // status is not set until map is saved once
status: this.permissions.getShareStatusDisplay(), if (status) share_status.textContent = L._('Visibility: {status}', {
status: status,
}) })
} }
update() update()
this.once('saved', L.bind(update, this))
name.href = '#' name.href = '#'
share_status.href = '#' share_status.href = '#'
logo.href = '/' logo.href = '/'