Skip to content

Commit

Permalink
Make file actions available on share routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Apr 27, 2022
1 parent 2f412bd commit 7c4d100
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
if (resources[0].status !== ShareStatus.accepted) {
return false
}
// FIXME: also check via capabilities if resharing is enabled + resharing is allowed on the share
}
return canShare(resources[0], this.$store)
},
Expand Down
1 change: 1 addition & 0 deletions packages/web-app-files/src/mixins/actions/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default {
if (
!isLocationSpacesActive(this.$router, 'files-spaces-personal-home') &&
!isLocationSpacesActive(this.$router, 'files-spaces-project') &&
!isLocationSpacesActive(this.$router, 'files-spaces-share') &&
!isLocationPublicActive(this.$router, 'files-public-files')
) {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
this.$_isFilesAppActive &&
!isLocationSpacesActive(this.$router, 'files-spaces-personal-home') &&
!isLocationSpacesActive(this.$router, 'files-spaces-project') &&
!isLocationSpacesActive(this.$router, 'files-spaces-share') &&
!isLocationPublicActive(this.$router, 'files-public-files') &&
!isLocationCommonActive(this.$router, 'files-common-favorites')
) {
Expand Down
1 change: 1 addition & 0 deletions packages/web-app-files/src/mixins/actions/downloadFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default {
this.$_isFilesAppActive &&
!isLocationSpacesActive(this.$router, 'files-spaces-personal-home') &&
!isLocationSpacesActive(this.$router, 'files-spaces-project') &&
!isLocationSpacesActive(this.$router, 'files-spaces-share') &&
!isLocationPublicActive(this.$router, 'files-public-files') &&
!isLocationCommonActive(this.$router, 'files-common-favorites')
) {
Expand Down
1 change: 0 additions & 1 deletion packages/web-app-files/src/mixins/actions/showShares.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default {
if (resources[0].status !== ShareStatus.accepted) {
return false
}
// FIXME: also check via capabilities if resharing is enabled + resharing is allowed on the share
}
return canShare(resources[0], this.$store)
},
Expand Down
17 changes: 12 additions & 5 deletions packages/web-app-files/src/quickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ export async function openSpaceMembersPanel(ctx) {
}

export function canShare(item, store) {
return (
store.state.user.capabilities.files_sharing &&
store.state.user.capabilities.files_sharing.api_enabled &&
item.canShare()
)
const { capabilities } = store.state.user
if (
!capabilities.files_sharing ||
!capabilities.files_sharing.api_enabled ||
!capabilities.files_sharing.can_share
) {
return false
}
if (item.isReceivedShare() && !capabilities.resharing) {
return false
}
return item.canShare()
}

export default {
Expand Down

0 comments on commit 7c4d100

Please sign in to comment.