diff --git a/changelog/unreleased/bugfix-shares-loading b/changelog/unreleased/bugfix-shares-loading new file mode 100644 index 00000000000..43300ac4f57 --- /dev/null +++ b/changelog/unreleased/bugfix-shares-loading @@ -0,0 +1,18 @@ +Bugfix: Shares loading + +We've improved the loading of shares: + +* Share loading now happens more globally in the sidebar component instead of in each sidebar panel. +* Shares won't be loaded for resources without a path anymore, which massively increases performance. +* Several issues with (re-)share permissions have been fixed. +* `loadCurrentFileOutgoingShares` and `loadIncomingShares` mutations have been removed. Instead, incoming and outgoing shares are now being loaded via `loadSharesTree()`. This avoids `getShare()` requests from being executed multiple times. +* Space member loading has been decoupled from shares loading in store. This reduces fetching of space members to a minimum and improves the structure of the code. +* Reactive loading of share indicators in sidebar details panel has been fixed. +* Reactive loading of space member count in the spaces overview has been fixed. +* Loading of indirect shares within spaces has been fixed. + +https://github.com/owncloud/web/issues/7506 +https://github.com/owncloud/web/issues/7593 +https://github.com/owncloud/web/issues/7592 +https://github.com/owncloud/web/pull/7580 +https://github.com/owncloud/web/pull/7638 diff --git a/changelog/unreleased/bugfix-shares-tree-loading b/changelog/unreleased/bugfix-shares-tree-loading deleted file mode 100644 index aa4ce452104..00000000000 --- a/changelog/unreleased/bugfix-shares-tree-loading +++ /dev/null @@ -1,13 +0,0 @@ -Bugfix: Shares tree loading - -We've improved loading of the shares tree: - -* It now happens more globally in the sidebar component instead of in each sidebar panel. -* Shares won't be loaded for resources without a path anymore. - -These changes massively improve the sidebar performance and fix several issues with (re-)share permissions. - -https://github.com/owncloud/web/issues/7506 -https://github.com/owncloud/web/issues/7593 -https://github.com/owncloud/web/issues/7592 -https://github.com/owncloud/web/pull/7580 diff --git a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue index 7bbfb4c8a2a..5651d44639f 100644 --- a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue +++ b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue @@ -209,7 +209,7 @@ export default defineComponent({ timeout: null }), computed: { - ...mapGetters('Files', ['versions', 'sharesTree', 'sharesTreeLoading']), + ...mapGetters('Files', ['versions', 'sharesTree', 'sharesTreeLoading', 'highlightedFile']), ...mapGetters(['user', 'configuration']), file() { @@ -357,7 +357,7 @@ export default defineComponent({ handler() { // missing early return this.sharedItem = null - this.shareIndicators = getIndicators(this.file, this.sharesTree) + this.shareIndicators = getIndicators(this.highlightedFile, this.sharesTree) const sharePathParentOrCurrent = this.getParentSharePath(this.file.path, this.sharesTree) if (sharePathParentOrCurrent === null) { return diff --git a/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue b/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue index 8993c417087..3f403fe22f9 100644 --- a/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue +++ b/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue @@ -121,11 +121,8 @@ export default defineComponent({ return { loadImageTask, spaceImage } }, computed: { - ...mapGetters('Files', [ - 'highlightedFile', - 'currentFileOutgoingCollaborators', - 'currentFileOutgoingLinks' - ]), + ...mapGetters('Files', ['currentFileOutgoingLinks']), + ...mapGetters('runtime/spaces', ['spaceMembers']), ...mapGetters(['user']), space() { return this.displayedItem.value @@ -188,7 +185,7 @@ export default defineComponent({ }, ownerUsernames() { const userId = this.user?.id - return this.currentFileOutgoingCollaborators + return this.spaceMembers .filter((share) => share.role.name === spaceRoleManager.name) .map((share) => { if (share.collaborator.name === userId) { @@ -207,7 +204,7 @@ export default defineComponent({ return this.linkShareCount > 0 }, memberShareCount() { - return this.currentFileOutgoingCollaborators.length + return this.spaceMembers.length }, linkShareCount() { return this.currentFileOutgoingLinks.length diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue index f749615e1c5..1fb20beb6cb 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue @@ -88,7 +88,6 @@ import { } from 'web-pkg/src/composables' import { defineComponent } from '@vue/runtime-core' -import { useGraphClient } from 'web-client/src/composables' // just a dummy function to trick gettext tools const $gettext = (str) => { @@ -118,7 +117,6 @@ export default defineComponent({ setup() { return { - ...useGraphClient(), hasResharing: useCapabilityFilesSharingResharing(), hasShareJail: useCapabilityShareJailEnabled() } @@ -139,6 +137,7 @@ export default defineComponent({ }, computed: { ...mapGetters('Files', ['currentFileOutgoingCollaborators', 'highlightedFile']), + ...mapGetters('runtime/spaces', ['spaceMembers']), ...mapGetters(['configuration', 'user', 'capabilities']), $_announcementWhenCollaboratorAdded() { @@ -170,6 +169,7 @@ export default defineComponent({ methods: { ...mapActions('Files', ['addShare']), + ...mapActions('runtime/spaces', ['addSpaceMember']), async fetchRecipients(query) { try { @@ -211,7 +211,10 @@ export default defineComponent({ ) }) - const exists = this.currentFileOutgoingCollaborators.find((existingCollaborator) => { + const existingShares = this.resourceIsSpace + ? this.spaceMembers + : this.currentFileOutgoingCollaborators + const exists = existingShares.find((existingCollaborator) => { return ( collaborator.value.shareWith === existingCollaborator.collaborator.name && parseInt(collaborator.value.shareType, 10) === existingCollaborator.shareType @@ -296,9 +299,9 @@ export default defineComponent({ path = `/${this.highlightedFile.name}` } - this.addShare({ + const addMethod = this.resourceIsSpace ? this.addSpaceMember : this.addShare + addMethod({ client: this.$client, - graphClient: this.graphClient, path, $gettext: this.$gettext, shareWith: collaborator.value.shareWith, diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue index 15996fb8d7d..e1157ca03e0 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue @@ -111,7 +111,6 @@ import { SharePermissions, ShareTypes } from 'web-client/src/helpers/share' import { useCapabilityFilesSharingResharing } from 'web-pkg/src/composables' import { extractDomSelector } from 'web-client/src/helpers/resource' import { defineComponent } from '@vue/composition-api' -import { useGraphClient } from 'web-client/src/composables' import * as uuid from 'uuid' import { formatDateFromDateTime, formatRelativeDateFromDateTime } from 'web-pkg/src/helpers' @@ -137,7 +136,6 @@ export default defineComponent({ }, setup() { return { - ...useGraphClient(), hasResharing: useCapabilityFilesSharingResharing() } }, @@ -321,6 +319,7 @@ export default defineComponent({ methods: { ...mapActions(['showMessage']), ...mapActions('Files', ['changeShare']), + ...mapActions('runtime/spaces', ['changeSpaceMember']), removeShare() { this.$emit('onDelete', this.share) @@ -360,12 +359,10 @@ export default defineComponent({ saveShareChanges({ role, permissions, expirationDate }) { const bitmask = role.hasCustomPermissions ? SharePermissions.permissionsToBitmask(permissions) - : SharePermissions.permissionsToBitmask( - role.permissions(this.hasResharing || this.shareType === ShareTypes.space) - ) - this.changeShare({ + : SharePermissions.permissionsToBitmask(role.permissions(this.hasResharing || this.isSpace)) + const changeMethod = this.isSpace ? this.changeSpaceMember : this.changeShare + changeMethod({ client: this.$client, - graphClient: this.graphClient, share: this.share, permissions: bitmask, expirationDate: expirationDate || '', diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue b/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue index 073973137e8..deaf27b7329 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue @@ -65,7 +65,6 @@