From 656e109d2fe4aa8af3b68350cb1be342c4f4a5b8 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Fri, 5 Jul 2024 15:47:41 +0100 Subject: [PATCH 1/2] fix(SharingDetailsView): Prevent illegal unselection of read permissions With the exception of "file drop" on link shares all other shares need the read permissions at least. Signed-off-by: fenn-cs --- apps/files_sharing/src/views/SharingDetailsTab.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index 8254e84b4a3f2..7f8ae7d17d853 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -180,7 +180,7 @@ {{ t('files_sharing', 'Custom permissions') }}
- {{ t('files_sharing', 'Read') }} @@ -602,6 +602,9 @@ export default { // allowed to revoke it too (but not to grant it again). return (this.fileInfo.canDownload() || this.canDownload) }, + canRemoveReadPermission() { + return this.allowsFileDrop && this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK + }, // if newPassword exists, but is empty, it means // the user deleted the original password hasUnsavedPassword() { @@ -822,6 +825,10 @@ export default { this.setCustomPermissions = true } } + // Read permission required for share creation + if (!this.canRemoveReadPermission) { + this.hasRead = true + } }, handleCustomPermissions() { if (!this.isNewShare && (this.hasCustomPermissions || this.share.setCustomPermissions)) { From 7e208977dcd0aa0ce2b6a51b4a12e6bb98cdc4d9 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Fri, 5 Jul 2024 21:25:54 +0100 Subject: [PATCH 2/2] WIP: Update quick share select option `SharingEntryQuickSelect` should respond to changes and reflect the new state of shares when updates are done in the `SharingDetailsTab` Signed-off-by: fenn-cs --- .../src/components/SharingEntry.vue | 19 ++++++++++++++++ apps/files_sharing/src/views/SharingList.vue | 5 +++++ apps/files_sharing/src/views/SharingTab.vue | 22 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index 23127a6fe161d..40cae7d1ca302 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -63,6 +63,20 @@ export default { }, mixins: [SharesMixin, ShareDetails], + props: { + share: { + type: Object, + required: true, + }, + fileInfo: { + type: Object, + required: true, + }, + isUnique: { + type: Boolean, + required: true, + }, + }, computed: { title() { @@ -119,6 +133,11 @@ export default { this.onNoteSubmit() }, }, + watch: { + share(newShare) { + console.log('Shareeeeee prop changed:', newShare) + } + }, } diff --git a/apps/files_sharing/src/views/SharingList.vue b/apps/files_sharing/src/views/SharingList.vue index 7294294afa400..c3d8602382fa7 100644 --- a/apps/files_sharing/src/views/SharingList.vue +++ b/apps/files_sharing/src/views/SharingList.vue @@ -53,5 +53,10 @@ export default { } }, }, + watch: { + shares(old, newShares) { + console.log('Shares prop changed:', old, newShares) + } + } } diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 7e58cb6401e8b..e9d0d4596a455 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -77,6 +77,7 @@ :share="shareDetailsData.share" @close-sharing-details="toggleShareDetailsView" @add:share="addShare" + @update:share="handleShareUpdated" @remove:share="removeShare" /> @@ -400,6 +401,27 @@ export default { }) } }, + + handleShareUpdated(updatedShare) { + // Check if the updated share is in the `shares` list + let index = this.shares.findIndex(share => share.id === updatedShare.id) + if (index !== -1) { + console.log("Let us see", this.shares[index].permissions, updatedShare.permissions) + // Update the share in the `shares` list + this.$set(this.shares, index, updatedShare) + console.log('Updated???', updatedShare) + console.log("Let us see (AFTER)", this.shares[index].permissions, updatedShare.permissions) + } else { + // Check if the updated share is in the `linkShares` list + index = this.linkShares.findIndex(share => share.id === updatedShare.id) + if (index !== -1) { + // Update the share in the `linkShares` list + this.$set(this.linkShares, index, updatedShare) + this.linkShares[index] = updatedShare + console.log('Updated link???', updatedShare) + } + } + }, }, }