Skip to content

Commit

Permalink
Sharing jail followup #1 (#7379)
Browse files Browse the repository at this point in the history
* Allow decline share in spaces/shares/ route

* Don't show delete action in files/spaces/shares breadcrumb
  • Loading branch information
Jan authored Aug 1, 2022
1 parent 2b73f45 commit 501005c
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-decline-share-not-possible
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Decline share not possible

We've fixed a bug where declining an accepted share in the dropdown next to the breadcrumb was not possible.

https://github.com/owncloud/web/pull/7379
https://github.com/owncloud/web/issues/6899
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Open file on shared space resource not possible

We've fixed a bug where opening a file of a shared space resource for example in the pdf viewer app wasn't possible.

https://github.com/owncloud/web/pull/7379
https://github.com/owncloud/web/issues/6899
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Rename shared space resource not possible

We've fixed a bug where renaming a file or a folder of a shared space wasn't possible.

https://github.com/owncloud/web/pull/7379
https://github.com/owncloud/web/issues/6899
4 changes: 3 additions & 1 deletion packages/web-app-files/src/helpers/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ export function buildSharedResource(
resource.shareOwnerDisplayname = share.displayname_owner
resource.name = path.basename(share.path)
resource.path = share.path
resource.webDavPath = buildWebDavFilesPath(share.uid_owner, share.path)
resource.webDavPath = hasShareJail
? buildWebDavSpacesPath(resource.storageId, share.path)
: buildWebDavFilesPath(share.uid_owner, share.path)
resource.canDownload = () => true
resource.canShare = () => true
resource.canRename = () => true
Expand Down
30 changes: 26 additions & 4 deletions packages/web-app-files/src/mixins/actions/declineShare.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { triggerShareAction } from '../../helpers/share/triggerShareAction'
import { isLocationSharesActive } from '../../router'
import { isLocationSharesActive, isLocationSpacesActive, createLocationShares } from '../../router'
import { mapActions, mapGetters, mapMutations } from 'vuex'
import PQueue from 'p-queue'
import { ShareStatus } from '../../helpers/share'
Expand All @@ -23,13 +23,23 @@ export default {
label: ({ resources }) =>
this.$ngettext('Decline share', 'Decline shares', resources.length),
isEnabled: ({ resources }) => {
if (!isLocationSharesActive(this.$router, 'files-shares-with-me')) {
if (
!isLocationSharesActive(this.$router, 'files-shares-with-me') &&
!isLocationSpacesActive(this.$router, 'files-spaces-share')
) {
return false
}
if (resources.length === 0) {
return false
}

if (
isLocationSpacesActive(this.$router, 'files-spaces-share') &&
(resources.length > 1 || resources[0].path !== '/')
) {
return false
}

const declineDisabled = resources.some((resource) => {
return resource.status === ShareStatus.declined
})
Expand Down Expand Up @@ -74,13 +84,25 @@ export default {

if (errors.length === 0) {
this.resetFileSelection()

if (isLocationSpacesActive(this.$router, 'files-spaces-share')) {
this.showMessage({
title: this.$ngettext(
'The selected share was declined successfully',
'The selected shares were declined successfully',
resources.length
)
})
this.$router.push(createLocationShares('files-shares-with-me'))
}

return
}

this.showMessage({
title: this.$ngettext(
'Failed to decline the selected share.',
'Failed to decline selected shares.',
'Failed to decline the selected share',
'Failed to decline selected shares',
resources.length
),
status: 'danger'
Expand Down
7 changes: 7 additions & 0 deletions packages/web-app-files/src/mixins/actions/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export default {
return false
}

if (
isLocationSpacesActive(this.$router, 'files-spaces-share') &&
resources[0].path === '/'
) {
return false
}

const deleteDisabled = resources.some((resource) => {
return !resource.canBeDeleted()
})
Expand Down

0 comments on commit 501005c

Please sign in to comment.