diff options
author | nfebe <fenn25.fn@gmail.com> | 2025-04-29 00:29:01 +0100 |
---|---|---|
committer | nfebe <fenn25.fn@gmail.com> | 2025-05-16 12:36:53 +0100 |
commit | 6558dc9383e407cfe76391bdd1b1f80accc6ec56 (patch) | |
tree | f3e0f8ff28ae973f3d49d659053338551c51ece9 | |
parent | 4f583f073c163237bca1049b5b7b26d57d602fa9 (diff) | |
download | nextcloud-server-fix/stable30/create-download-attribute-if-missing.tar.gz nextcloud-server-fix/stable30/create-download-attribute-if-missing.zip |
fix(files_sharing): Create `download` attribute when toggling checkbox if missingfix/stable30/create-download-attribute-if-missing
Previously, toggling the checkbox did not create the 'download' attribute if it was missing,
causing it to become unresponsive after a page reload. Now, setShareAttribute ensures the
attribute is updated or created correctly.
Signed-off-by: nfebe <fenn25.fn@gmail.com>
-rw-r--r-- | apps/files_sharing/src/views/SharingDetailsTab.vue | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index a1dc5c78459..76478d447b7 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -430,11 +430,7 @@ export default { return this.share.attributes.find(attr => attr.key === 'download')?.value || false }, set(checked) { - // Find the 'download' attribute and update its value - const downloadAttr = this.share.attributes.find(attr => attr.key === 'download') - if (downloadAttr) { - downloadAttr.value = checked - } + this.setShareAttribute('permissions', 'download', checked) }, }, /** @@ -744,6 +740,30 @@ export default { }, methods: { + /** + * Set a share attribute on the current share + * @param {string} scope The attribute scope + * @param {string} key The attribute key + * @param {boolean} value The value + */ + setShareAttribute(scope, key, value) { + if (!this.share.attributes) { + this.$set(this.share, 'attributes', []) + } + + const attribute = this.share.attributes + .find((attr) => attr.scope === scope || attr.key === key) + + if (attribute) { + attribute.value = value + } else { + this.share.attributes.push({ + scope, + key, + value, + }) + } + }, updateAtomicPermissions({ isReadChecked = this.hasRead, isEditChecked = this.canEdit, |