Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-07-15 18:11:54 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-08-03 14:24:38 +0300
commitaafaa3951550347f47e53b44675cd66c77916535 (patch)
tree2637c86b65726b7704681dc0a6019096265a9974 /apps/files_sharing/src
parent146dda4266e8b5252a4c0eff1ad3552e2dd651f5 (diff)
Multiple fixes
- Fix tests - Use non deprecated event stuff - Add a bit of type hinting to the new stuff - More safe handling of instanceOfStorage (share might not be the first wrapper) - Fix resharing Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue33
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue9
2 files changed, 39 insertions, 3 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index d8bf5bcccc9..ad4147f0c9b 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -80,8 +80,9 @@
<ActionCheckbox ref="canDownload"
:checked.sync="canDownload"
+ v-if="isSetDownloadButtonVisible"
:disabled="saving || !canSetDownload">
- {{ t('files_sharing', 'Allow download') }}
+ {{ allowDownloadText }}
</ActionCheckbox>
<!-- expiration date -->
@@ -407,6 +408,36 @@ export default {
return (typeof this.share.status === 'object' && !Array.isArray(this.share.status))
},
+ /**
+ * @return {string}
+ */
+ allowDownloadText() {
+ if (this.isFolder) {
+ return t('files_sharing', 'Allow download of office files')
+ } else {
+ return t('files_sharing', 'Allow download')
+ }
+ },
+
+ /**
+ * @return {boolean}
+ */
+ isSetDownloadButtonVisible() {
+ const allowedMimetypes = [
+ // Office documents
+ 'application/msword',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'application/vnd.ms-powerpoint',
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+ 'application/vnd.ms-excel',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'application/vnd.oasis.opendocument.text',
+ 'application/vnd.oasis.opendocument.spreadsheet',
+ 'application/vnd.oasis.opendocument.presentation',
+ ]
+
+ return this.isFolder || allowedMimetypes.includes(this.fileInfo.mimetype)
+ },
},
methods: {
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index d5acf64c202..2dc10de5484 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -158,7 +158,7 @@
<ActionSeparator />
<ActionCheckbox :checked.sync="share.hideDownload"
- :disabled="saving"
+ :disabled="saving || canChangeHideDownload"
@change="queueUpdate('hideDownload')">
{{ t('files_sharing', 'Hide download') }}
</ActionCheckbox>
@@ -606,6 +606,12 @@ export default {
isPasswordPolicyEnabled() {
return typeof this.config.passwordPolicy === 'object'
},
+
+ canChangeHideDownload() {
+ const hasDisabledDownload = (shareAttribute) => shareAttribute.key === 'download' && shareAttribute.scope === 'permissions' && shareAttribute.enabled === false
+
+ return this.fileInfo.shareAttributes.some(hasDisabledDownload)
+ },
},
methods: {
@@ -867,7 +873,6 @@ export default {
this.$emit('remove:share', this.share)
},
},
-
}
</script>