From 501005c560067b7721bf65281f30e1547031f8aa Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 1 Aug 2022 12:28:36 +0200 Subject: [PATCH] Sharing jail followup #1 (#7379) * Allow decline share in spaces/shares/ route * Don't show delete action in files/spaces/shares breadcrumb --- .../bugfix-decline-share-not-possible | 6 ++++ ...file-on-shared-space-resource-not-possible | 6 ++++ ...-rename-shared-space-resource-not-possible | 6 ++++ .../web-app-files/src/helpers/resources.ts | 4 ++- .../src/mixins/actions/declineShare.js | 30 ++++++++++++++++--- .../src/mixins/actions/delete.js | 7 +++++ 6 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/bugfix-decline-share-not-possible create mode 100644 changelog/unreleased/bugfix-open-file-on-shared-space-resource-not-possible create mode 100644 changelog/unreleased/bugfix-rename-shared-space-resource-not-possible diff --git a/changelog/unreleased/bugfix-decline-share-not-possible b/changelog/unreleased/bugfix-decline-share-not-possible new file mode 100644 index 00000000000..0fef6c2dc2a --- /dev/null +++ b/changelog/unreleased/bugfix-decline-share-not-possible @@ -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 diff --git a/changelog/unreleased/bugfix-open-file-on-shared-space-resource-not-possible b/changelog/unreleased/bugfix-open-file-on-shared-space-resource-not-possible new file mode 100644 index 00000000000..16f3560f369 --- /dev/null +++ b/changelog/unreleased/bugfix-open-file-on-shared-space-resource-not-possible @@ -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 diff --git a/changelog/unreleased/bugfix-rename-shared-space-resource-not-possible b/changelog/unreleased/bugfix-rename-shared-space-resource-not-possible new file mode 100644 index 00000000000..c19dc7361e9 --- /dev/null +++ b/changelog/unreleased/bugfix-rename-shared-space-resource-not-possible @@ -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 diff --git a/packages/web-app-files/src/helpers/resources.ts b/packages/web-app-files/src/helpers/resources.ts index 52d2b09e0f0..89e43cfe918 100644 --- a/packages/web-app-files/src/helpers/resources.ts +++ b/packages/web-app-files/src/helpers/resources.ts @@ -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 diff --git a/packages/web-app-files/src/mixins/actions/declineShare.js b/packages/web-app-files/src/mixins/actions/declineShare.js index 9ee96d3a9ac..50432d6756a 100644 --- a/packages/web-app-files/src/mixins/actions/declineShare.js +++ b/packages/web-app-files/src/mixins/actions/declineShare.js @@ -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' @@ -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 }) @@ -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' diff --git a/packages/web-app-files/src/mixins/actions/delete.js b/packages/web-app-files/src/mixins/actions/delete.js index dda211a8b66..7be45be47cc 100644 --- a/packages/web-app-files/src/mixins/actions/delete.js +++ b/packages/web-app-files/src/mixins/actions/delete.js @@ -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() })