aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/PersonalSettings.vue2
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue5
-rw-r--r--apps/files_sharing/src/components/SharingEntryInherited.vue15
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue45
-rw-r--r--apps/files_sharing/src/components/SharingInput.vue18
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js19
-rw-r--r--apps/files_sharing/src/models/Share.js20
-rw-r--r--apps/files_sharing/src/views/SharingInherited.vue1
-rw-r--r--apps/files_sharing/src/views/SharingTab.vue10
9 files changed, 97 insertions, 38 deletions
diff --git a/apps/files_sharing/src/components/PersonalSettings.vue b/apps/files_sharing/src/components/PersonalSettings.vue
index dd10dec10d2..5ff795fc91a 100644
--- a/apps/files_sharing/src/components/PersonalSettings.vue
+++ b/apps/files_sharing/src/components/PersonalSettings.vue
@@ -21,7 +21,7 @@
<template>
<div v-if="!enforceAcceptShares" id="files-sharing-personal-settings" class="section">
- <h2>{{ t('files', 'Sharing') }}</h2>
+ <h2>{{ t('files_sharing', 'Sharing') }}</h2>
<p>
<input id="files-sharing-personal-settings-accept"
v-model="accepting"
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 1daec4be479..4af3a6b4431 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -23,6 +23,7 @@
<template>
<li class="sharing-entry">
<Avatar class="sharing-entry__avatar"
+ :is-no-user="share.type !== SHARE_TYPES.SHARE_TYPE_USER"
:user="share.shareWith"
:display-name="share.shareWithDisplayName"
:url="share.shareWithAvatar" />
@@ -92,10 +93,10 @@
:first-day-of-week="firstDay"
:lang="lang"
:value="share.expireDate"
+ value-type="format"
icon="icon-calendar-dark"
type="date"
- :not-before="dateTomorrow"
- :not-after="dateMaxEnforced"
+ :disabled-date="disabledDate"
@update:value="onExpirationChange">
{{ t('files_sharing', 'Enter a date') }}
</ActionInput>
diff --git a/apps/files_sharing/src/components/SharingEntryInherited.vue b/apps/files_sharing/src/components/SharingEntryInherited.vue
index 259599359d4..b8b5674efc9 100644
--- a/apps/files_sharing/src/components/SharingEntryInherited.vue
+++ b/apps/files_sharing/src/components/SharingEntryInherited.vue
@@ -35,10 +35,10 @@
<ActionText icon="icon-user">
{{ t('files_sharing', 'Added by {initiator}', { initiator: share.ownerDisplayName }) }}
</ActionText>
- <ActionLink v-if="share.canDelete && share.fileSource"
+ <ActionLink v-if="share.viaPath && share.viaFileid"
icon="icon-folder"
- :href="fileTargetUrl">
- {{ t('files_sharing', 'Via folder') }}
+ :href="viaFileTargetUrl">
+ {{ t('files_sharing', 'Via “{folder}”', {folder: viaFolderName} ) }}
</ActionLink>
<ActionButton v-if="share.canDelete"
icon="icon-close"
@@ -50,6 +50,7 @@
<script>
import { generateUrl } from '@nextcloud/router'
+import { basename } from '@nextcloud/paths'
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import ActionLink from '@nextcloud/vue/dist/Components/ActionLink'
@@ -81,11 +82,15 @@ export default {
},
computed: {
- fileTargetUrl() {
+ viaFileTargetUrl() {
return generateUrl('/f/{fileid}', {
- fileid: this.share.fileSource,
+ fileid: this.share.viaFileid,
})
},
+
+ viaFolderName() {
+ return basename(this.share.viaPath)
+ },
},
}
</script>
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index c7771cc8104..912825b35d6 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -104,8 +104,8 @@
:lang="lang"
icon=""
type="date"
- :not-before="dateTomorrow"
- :not-after="dateMaxEnforced">
+ value-type="format"
+ :disabled-date="disabledDate">
<!-- let's not submit when picked, the user
might want to still edit or copy the password -->
{{ t('files_sharing', 'Enter a date') }}
@@ -126,21 +126,21 @@
<template v-if="share.canEdit">
<!-- folder -->
<template v-if="isFolder && fileHasCreatePermission && config.isPublicUploadEnabled">
- <ActionRadio :checked="share.permissions === publicUploadRValue"
+ <ActionRadio :checked="sharePermissions === publicUploadRValue"
:value="publicUploadRValue"
:name="randomId"
:disabled="saving"
@change="togglePermissions">
{{ t('files_sharing', 'Read only') }}
</ActionRadio>
- <ActionRadio :checked="share.permissions === publicUploadRWValue"
+ <ActionRadio :checked="sharePermissions === publicUploadRWValue"
:value="publicUploadRWValue"
:disabled="saving"
:name="randomId"
@change="togglePermissions">
{{ t('files_sharing', 'Allow upload and editing') }}
</ActionRadio>
- <ActionRadio :checked="share.permissions === publicUploadWValue"
+ <ActionRadio :checked="sharePermissions === publicUploadWValue"
:value="publicUploadWValue"
:disabled="saving"
:name="randomId"
@@ -227,10 +227,10 @@
:first-day-of-week="firstDay"
:lang="lang"
:value="share.expireDate"
+ value-type="format"
icon="icon-calendar-dark"
type="date"
- :not-before="dateTomorrow"
- :not-after="dateMaxEnforced"
+ :disabled-date="disabledDate"
@update:value="onExpirationChange">
{{ t('files_sharing', 'Enter a date') }}
</ActionInput>
@@ -359,6 +359,15 @@ export default {
computed: {
/**
+ * Return the current share permissions
+ * We always ignore the SHARE permission as this is used for the
+ * federated sharing.
+ * @returns {number}
+ */
+ sharePermissions() {
+ return this.share.permissions & ~OC.PERMISSION_SHARE
+ },
+ /**
* Generate a unique random id for this SharingEntryLink only
* This allows ActionRadios to have the same name prop
* but not to impact others SharingEntryLink
@@ -396,15 +405,19 @@ export default {
* @returns {boolean}
*/
hasExpirationDate: {
- get: function() {
- return this.config.isDefaultExpireDateEnforced || !!this.share.expireDate
+ get() {
+ return this.config.isDefaultExpireDateEnforced
+ || !!this.share.expireDate
},
- set: function(enabled) {
- this.share.expireDate = enabled
- ? this.config.defaultExpirationDateString !== ''
- ? this.config.defaultExpirationDateString
- : moment().format('YYYY-MM-DD')
+ set(enabled) {
+ let dateString = moment(this.config.defaultExpirationDateString)
+ if (!dateString.isValid()) {
+ dateString = moment()
+ }
+ this.share.state.expiration = enabled
+ ? dateString.format('YYYY-MM-DD')
: ''
+ console.debug('Expiration date status', enabled, this.share.expireDate)
},
},
@@ -418,11 +431,11 @@ export default {
* @returns {boolean}
*/
isPasswordProtected: {
- get: function() {
+ get() {
return this.config.enforcePasswordForPublicLink
|| !!this.share.password
},
- set: async function(enabled) {
+ async set(enabled) {
// TODO: directly save after generation to make sure the share is always protected
Vue.set(this.share, 'password', enabled ? await this.generatePassword() : '')
Vue.set(this.share, 'newPassword', this.share.password)
diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue
index 833264f0ad2..d4ba4f91624 100644
--- a/apps/files_sharing/src/components/SharingInput.vue
+++ b/apps/files_sharing/src/components/SharingInput.vue
@@ -306,14 +306,16 @@ export default {
return arr
}
try {
- // filter out current user
- if (share.value.shareWith === getCurrentUser().uid) {
- return arr
- }
+ if (share.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER) {
+ // filter out current user
+ if (share.value.shareWith === getCurrentUser().uid) {
+ return arr
+ }
- // filter out the owner of the share
- if (this.reshare && share.value.shareWith === this.reshare.owner) {
- return arr
+ // filter out the owner of the share
+ if (this.reshare && share.value.shareWith === this.reshare.owner) {
+ return arr
+ }
}
// filter out existing mail shares
@@ -394,7 +396,7 @@ export default {
shareWith: result.value.shareWith,
shareType: result.value.shareType,
user: result.uuid || result.value.shareWith,
- isNoUser: !result.uuid,
+ isNoUser: result.value.shareType !== this.SHARE_TYPES.SHARE_TYPE_USER,
displayName: result.name || result.label,
desc,
icon: this.shareTypeToIcon(result.value.shareType),
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index 2622edaf5e2..e19af48bc7e 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -64,7 +64,7 @@ export default {
* ! This allow vue to make the Share class state reactive
* ! do not remove it ot you'll lose all reactivity here
*/
- reactiveState: this.share && this.share.state,
+ reactiveState: this.share?.state,
SHARE_TYPES: {
SHARE_TYPE_USER: OC.Share.SHARE_TYPE_USER,
@@ -246,8 +246,10 @@ export default {
// reset password state after sync
this.$delete(this.share, 'newPassword')
- } catch ({ property, message }) {
- this.onSyncError(property, message)
+ } catch ({ message }) {
+ if (message && message !== '') {
+ this.onSyncError(property, message)
+ }
} finally {
this.saving = false
}
@@ -298,5 +300,16 @@ export default {
debounceQueueUpdate: debounce(function(property) {
this.queueUpdate(property)
}, 500),
+
+ /**
+ * Returns which dates are disabled for the datepicker
+ * @param {Date} date date to check
+ * @returns {boolean}
+ */
+ disabledDate(date) {
+ const dateMoment = moment(date)
+ return (this.dateTomorrow && dateMoment.isBefore(this.dateTomorrow, 'day'))
+ || (this.dateMaxEnforced && dateMoment.isSameOrAfter(this.dateMaxEnforced, 'day'))
+ },
},
}
diff --git a/apps/files_sharing/src/models/Share.js b/apps/files_sharing/src/models/Share.js
index 1c8c24cfc7b..92ea314071f 100644
--- a/apps/files_sharing/src/models/Share.js
+++ b/apps/files_sharing/src/models/Share.js
@@ -467,6 +467,26 @@ export default class Share {
return this.#share.can_delete === true
}
+ /**
+ * Top level accessible shared folder fileid for the current user
+ * @returns {string}
+ * @readonly
+ * @memberof Share
+ */
+ get viaFileid() {
+ return this.#share.via_fileid
+ }
+
+ /**
+ * Top level accessible shared folder path for the current user
+ * @returns {string}
+ * @readonly
+ * @memberof Share
+ */
+ get viaPath() {
+ return this.#share.via_path
+ }
+
// TODO: SORT THOSE PROPERTIES
get label() {
return this.#share.label
diff --git a/apps/files_sharing/src/views/SharingInherited.vue b/apps/files_sharing/src/views/SharingInherited.vue
index 67a57a96b62..b688a70fa1a 100644
--- a/apps/files_sharing/src/views/SharingInherited.vue
+++ b/apps/files_sharing/src/views/SharingInherited.vue
@@ -38,6 +38,7 @@
<!-- Inherited shares list -->
<SharingEntryInherited v-for="share in shares"
:key="share.id"
+ :file-info="fileInfo"
:share="share" />
</ul>
</template>
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue
index 2e68377b0b1..445bad3795c 100644
--- a/apps/files_sharing/src/views/SharingTab.vue
+++ b/apps/files_sharing/src/views/SharingTab.vue
@@ -183,9 +183,11 @@ export default {
},
watch: {
- fileInfo() {
- this.resetState()
- this.getShares()
+ fileInfo(newFile, oldFile) {
+ if (newFile.id !== oldFile.id) {
+ this.resetState()
+ this.getShares()
+ }
},
},
@@ -284,6 +286,8 @@ export default {
this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL)
this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)
+ console.debug('Processed', this.linkShares.length, 'link share(s)')
+ console.debug('Processed', this.shares.length, 'share(s)')
}
},