UI Bugfix: Allow changing of data onn previously unconfigured share

This commit is contained in:
Max Berger
2026-06-12 08:22:42 +02:00
parent bb2edcbc4e
commit d612b00ba0
2 changed files with 57 additions and 1 deletions

View File

@@ -129,6 +129,59 @@ def test_sharing_config_save_and_reload(
page.click('#createeditsharescene button[data-name="cancel"]') page.click('#createeditsharescene button[data-name="cancel"]')
def test_sharing_config_bday_save_empty_reenter_edit_age(
context: BrowserContext, page: Page, radicale_server: str, config: Config
) -> None:
_create_addressbook_and_open_share(
context, page, radicale_server, config, "Addressbook for Empty Bday Edit"
)
# Select Birthday conversion
page.click('label[for="newshare_conv_bday"]')
# Fill share map fields (user and href)
page.locator('input[data-name="shareuser"]').fill("max")
page.locator('input[data-name="sharehref"]').fill("mapped-bday-empty-reenter")
# Save immediately without setting any config
page.click('#createeditsharescene button[data-name="submit"]')
# Verify share created
expect(
page.locator("tr[data-name='sharemaprowtemplate']:not(.hidden)")
).to_have_count(1)
# Re-open share in edit mode
page.click(
"tr[data-name='sharemaprowtemplate']:not(.hidden) button[data-name='edit']",
strict=True,
)
# Change max age config value (previously triggered SyntaxError: JSON.parse: unexpected character)
page.locator("#newshare_config_conversion_bday_age_max").fill("123")
# Save
page.click('#createeditsharescene button[data-name="submit"]')
# Verify share updated and returned to share collection scene
expect(
page.locator("tr[data-name='sharemaprowtemplate']:not(.hidden)")
).to_have_count(1)
# Re-open share in edit mode again to verify it saved
page.click(
"tr[data-name='sharemaprowtemplate']:not(.hidden) button[data-name='edit']",
strict=True,
)
expect(page.locator("#newshare_config_conversion_bday_age_max")).to_have_value(
"123"
)
page.click('#createeditsharescene button[data-name="cancel"]')
page.click('#sharecollectionscene button[data-name="cancel"]')
def test_sharing_config_delete_checkbox( def test_sharing_config_delete_checkbox(
context: BrowserContext, page: Page, radicale_server: str, config: Config context: BrowserContext, page: Page, radicale_server: str, config: Config
) -> None: ) -> None:

View File

@@ -309,7 +309,10 @@ export class CreateEditShareScene {
/** @type {Record<string, any>} */ /** @type {Record<string, any>} */
let new_actions = {}; let new_actions = {};
if (this._edit && this._share && this._share.Actions) { if (this._edit && this._share && this._share.Actions) {
new_actions = JSON.parse(JSON.stringify(this._share.Actions)); let actions_json = JSON.stringify(this._share.Actions);
if (actions_json) {
new_actions = JSON.parse(actions_json);
}
} }
if (conversion_value === "bday") { if (conversion_value === "bday") {
let new_config = new ShareConfig(); let new_config = new ShareConfig();