Skip to content

Commit

Permalink
fix: only allow to set a map as sync when it is already saved (#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanboniface authored Jan 31, 2025
2 parents 3e9982c + 2162aaf commit 1d6e74e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion umap/static/umap/js/modules/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ export default class Umap extends ServerStored {
this._editOverlay(container)
this._editBounds(container)
this._editSlideshow(container)
if (this.properties.websocketEnabled) {
if (this.properties.websocketEnabled && this.id) {
this._editSync(container)
}
this._advancedActions(container)
Expand Down
3 changes: 3 additions & 0 deletions umap/tests/integration/test_websocket_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,12 @@ def test_create_and_sync_map(new_page, asgi_live_server, tilelayer, login, user)
# Create a syncable map with peerA
peerA = login(user, prefix="Page A")
peerA.goto(f"{asgi_live_server.url}/en/map/new/")
peerA.get_by_role("link", name="Map advanced properties").click()
expect(peerA.get_by_text("Real-time collaboration", exact=True)).to_be_hidden()
with peerA.expect_response(re.compile("./map/create/.*")):
peerA.get_by_role("button", name="Save Draft").click()
peerA.get_by_role("link", name="Map advanced properties").click()
expect(peerA.get_by_text("Real-time collaboration", exact=True)).to_be_visible()
peerA.get_by_text("Real-time collaboration", exact=True).click()
peerA.get_by_text("Enable real-time").click()
peerA.get_by_role("link", name="Update permissions and editors").click()
Expand Down

0 comments on commit 1d6e74e

Please sign in to comment.