Skip to content

Commit

Permalink
fix(share): Send correct share attributes upon share creation
Browse files Browse the repository at this point in the history
- Send correct share attributes (`share.attributes`) to server upon creation.
- Delete parts of code that create or reference, `share.hasDownloadPermission`
(Not required by Share API)

Resolves : #44131

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
  • Loading branch information
Fenn-CS committed Mar 26, 2024
1 parent 1a55084 commit b39487f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,14 @@ export default {
*/
canDownload: {
get() {
return this.share.hasDownloadPermission
return this.share.attributes.find(attr => attr.key === 'download')?.enabled || false
},
set(checked) {
this.updateAtomicPermissions({ isDownloadChecked: checked })
// Find the 'download' attribute and update its value
const downloadAttr = this.share.attributes.find(attr => attr.key === 'download')
if (downloadAttr) {
downloadAttr.enabled = checked
}
},
},
/**
Expand Down Expand Up @@ -723,7 +727,6 @@ export default {
isCreateChecked = this.canCreate,
isDeleteChecked = this.canDelete,
isReshareChecked = this.canReshare,
isDownloadChecked = this.canDownload,
} = {}) {
// calc permissions if checked
const permissions = 0
Expand All @@ -733,9 +736,6 @@ export default {
| (isEditChecked ? ATOMIC_PERMISSIONS.UPDATE : 0)
| (isReshareChecked ? ATOMIC_PERMISSIONS.SHARE : 0)
this.share.permissions = permissions
if (this.share.hasDownloadPermission !== isDownloadChecked) {
this.$set(this.share, 'hasDownloadPermission', isDownloadChecked)
}
},
expandCustomPermissions() {
if (!this.advancedSectionAccordionExpanded) {
Expand Down Expand Up @@ -911,7 +911,8 @@ export default {
shareType: share.shareType,
shareWith: share.shareWith,
permissions: share.permissions,
attributes: JSON.stringify(fileInfo.shareAttributes),
attributes: JSON.stringify(share.attributes),
...(share.note ? { note: share.note } : {}),
...(share.password ? { password: share.password } : {}),
...(share.expireDate ? { expireDate: share.expireDate } : {}),
Expand Down Expand Up @@ -1056,7 +1057,7 @@ export default {
flex-direction: column;
}
}
/* Target component based style in NcCheckboxRadioSwitch slot content*/
:deep(span.checkbox-content__text.checkbox-radio-switch__text) {
flex-wrap: wrap;
Expand Down

0 comments on commit b39487f

Please sign in to comment.