From: fenn-cs Date: Wed, 6 Dec 2023 21:05:57 +0000 (+0100) Subject: Remove `newPassword` from share model, if disabled X-Git-Tag: v29.0.0beta1~693^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e73a54906e4d0b1c0c8327275e601e12bdfe1f7f;p=nextcloud-server.git Remove `newPassword` from share model, if disabled It's important to delete the `newPassword` prop from the share model, if the user unchecks the isPasswordProtected checkbox. This clearer and allows for the unchecking to actually work as `this.$set()` fails with the falsy value `''`. Signed-off-by: fenn-cs --- diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index a4a312fcc0e..d882aac9b87 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -417,9 +417,13 @@ export default { || !!this.share.password }, async set(enabled) { - // TODO: directly save after generation to make sure the share is always protected - this.share.password = enabled ? await GeneratePassword() : '' - this.$set(this.share, 'newPassword', this.share.password) + if (enabled) { + this.share.password = await GeneratePassword() + this.$set(this.share, 'newPassword', this.share.password) + } else { + this.share.password = '' + this.$delete(this.share, 'newPassword') + } }, }, /**