Add confirmation on delete of share-by-token

This commit is contained in:
Max Berger
2026-03-04 21:35:00 +01:00
parent 066a133860
commit 95938766c4
2 changed files with 6 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ def test_create_and_delete_share_by_key(page: Page, radicale_server: str) -> Non
expect( expect(
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RO']") page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RO']")
).to_be_visible() ).to_be_visible()
page.once("dialog", lambda dialog: dialog.accept())
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True) page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
expect( expect(
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)") page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")
@@ -40,6 +41,7 @@ def test_create_and_delete_share_by_key(page: Page, radicale_server: str) -> Non
expect( expect(
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RW']") page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RW']")
).to_be_visible() ).to_be_visible()
page.once("dialog", lambda dialog: dialog.accept())
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True) page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
expect( expect(
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)") page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")

View File

@@ -28,14 +28,6 @@ import { Collection } from "./models.js";
import { Scene, pop_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
/** /**
* @constructor
* @implements {Scene}
* @param {string} user
* @param {string} password
* @param {Collection} collection The collection on which to edit sharing setting. Must exist.
*/
/**
* @constructor
* @implements {Scene} * @implements {Scene}
* @param {string} user * @param {string} user
* @param {string} password * @param {string} password
@@ -147,10 +139,13 @@ function add_share_rows(user, password, collection, shares) {
} }
/** @type {HTMLElement} */ let delete_btn = node.querySelector("[data-name=delete]"); /** @type {HTMLElement} */ let delete_btn = node.querySelector("[data-name=delete]");
delete_btn.onclick = function () { delete_btn.onclick = function () {
if (!confirm("Are you sure you want to delete share " + pathortoken + "?")) {
return;
}
delete_share_by_token( delete_share_by_token(
user, user,
password, password,
share["PathOrToken"], pathortoken,
function () { function () {
update_share_list(user, password, collection); update_share_list(user, password, collection);
}, },