Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing jail followup #1 #7379

Merged
merged 5 commits into from
Aug 1, 2022
Merged
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
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