From 82dde3139fdd8af98d44d6d8eaa4c368ca9eadab Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Wed, 6 Dec 2023 22:05:57 +0100 Subject: 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 --- apps/files_sharing/src/views/SharingDetailsTab.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apps/files_sharing/src') diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index 580d24eae58..67bfac3e74c 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -398,9 +398,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') + } }, }, /** -- cgit v1.2.3