Merge pull request #1614 from umap-project/fix-send-edit-link

fix: send edit link was using old post method
This commit is contained in:
Yohan Boniface 2024-02-16 16:55:36 +01:00 committed by GitHub
commit 2b196ab614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 4 deletions

View file

@ -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 () {

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"
)
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()