diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 4a0d797b..0366d4cb 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1130,7 +1130,7 @@ U.Map = L.Map.extend({ } }, - sendEditLink: function () { + sendEditLink: async function () { const input = this.ui._alert.querySelector('input') const email = input.value @@ -1138,9 +1138,7 @@ U.Map = L.Map.extend({ formData.append('email', email) const url = this.urls.get('map_send_edit_link', { map_id: this.options.umap_id }) - this.post(url, { - data: formData, - }) + await this.server.post(url, {}, formData) }, star: async function () { diff --git a/umap/tests/integration/test_anonymous_owned_map.py b/umap/tests/integration/test_anonymous_owned_map.py index ca0c4b66..24cc46a7 100644 --- a/umap/tests/integration/test_anonymous_owned_map.py +++ b/umap/tests/integration/test_anonymous_owned_map.py @@ -150,3 +150,22 @@ def test_can_change_perms_after_create(tilelayer, live_server, page): ".datalayer-permissions select[name='edit_status'] option:checked" ) expect(option).to_have_text("Inherit") + + +def test_alert_message_after_create(tilelayer, live_server, page): + page.goto(f"{live_server.url}/en/map/new") + save = page.get_by_role("button", name="Save") + expect(save).to_be_visible() + alert = page.locator(".umap-alert") + expect(alert).to_be_hidden() + with page.expect_response(re.compile(r".*/map/create/")): + save.click() + expect(alert).to_be_visible() + expect( + alert.get_by_text( + "Your map has been created! As you are not logged in, here is your secret " + "link to edit the map, please keep it safe:" + ) + ).to_be_visible() + expect(alert.get_by_role("button", name="Copy")).to_be_visible() + expect(alert.get_by_role("button", name="Send me the link")).to_be_visible()