Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions apps/files_sharing/src/components/SharingEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -119,6 +133,11 @@ export default {
this.onNoteSubmit()
},
},
watch: {
share(newShare) {
console.log('Shareeeeee prop changed:', newShare)
}
},
}
</script>

Expand Down
9 changes: 8 additions & 1 deletion apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
{{ t('files_sharing', 'Custom permissions') }}
</NcCheckboxRadioSwitch>
<section v-if="setCustomPermissions" class="custom-permissions-group">
<NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK"
<NcCheckboxRadioSwitch :disabled="!canRemoveReadPermission"
:checked.sync="hasRead"
data-cy-files-sharing-share-permissions-checkbox="read">
{{ t('files_sharing', 'Read') }}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)) {
Expand Down
5 changes: 5 additions & 0 deletions apps/files_sharing/src/views/SharingList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ export default {
}
},
},
watch: {
shares(old, newShares) {
console.log('Shares prop changed:', old, newShares)
}
}
}
</script>
22 changes: 22 additions & 0 deletions apps/files_sharing/src/views/SharingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
:share="shareDetailsData.share"
@close-sharing-details="toggleShareDetailsView"
@add:share="addShare"
@update:share="handleShareUpdated"
@remove:share="removeShare" />
</div>
</template>
Expand Down Expand Up @@ -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)
}
}
},
},
}
</script>
Expand Down