fix: send edit link was using old post method

This commit is contained in:
Yohan Boniface 2024-02-16 11:41:28 +01:00
parent 3f3392952c
commit 4c224fccbc
2 changed files with 21 additions and 4 deletions

View file

@ -1129,7 +1129,7 @@ U.Map = L.Map.extend({
} }
}, },
sendEditLink: function () { sendEditLink: async function () {
const input = this.ui._alert.querySelector('input') const input = this.ui._alert.querySelector('input')
const email = input.value const email = input.value
@ -1137,9 +1137,7 @@ U.Map = L.Map.extend({
formData.append('email', email) formData.append('email', email)
const url = this.urls.get('map_send_edit_link', { map_id: this.options.umap_id }) const url = this.urls.get('map_send_edit_link', { map_id: this.options.umap_id })
this.post(url, { await this.server.post(url, {}, formData)
data: formData,
})
}, },
star: function () { star: function () {

View file

@ -150,3 +150,22 @@ def test_can_change_perms_after_create(tilelayer, live_server, page):
".datalayer-permissions select[name='edit_status'] option:checked" ".datalayer-permissions select[name='edit_status'] option:checked"
) )
expect(option).to_have_text("Inherit") 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()