Skip to content

Commit

Permalink
Merge pull request #7870 from owncloud/fix-spaces-member-loading-shar…
Browse files Browse the repository at this point in the history
…ed-via-link

Fix space member loading on 'Shared via link'-page
  • Loading branch information
kulmann authored Nov 2, 2022
2 parents 934c11e + 34de9e9 commit 10a76c7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 25 deletions.
2 changes: 2 additions & 0 deletions changelog/unreleased/bugfix-spaces-on-share-via-link-page
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ Spaces on the "Shared via link"-page are now being displayed correctly. Also, th

https://github.com/owncloud/web/pull/7651
https://github.com/owncloud/web/pull/7742
https://github.com/owncloud/web/pull/7870
https://github.com/owncloud/web/issues/7103
https://github.com/owncloud/web/issues/7741
https://github.com/owncloud/web/issues/7869
9 changes: 8 additions & 1 deletion packages/web-app-files/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ import { computed, defineComponent, PropType } from '@vue/composition-api'
import {
useCapabilityShareJailEnabled,
useClientService,
useGraphClient,
usePublicLinkPassword,
useStore
} from 'web-pkg/src/composables'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { SideBarEventTopics } from '../../composables/sideBar'
import isEqual from 'lodash-es/isEqual'
import { useActiveLocation } from '../../composables'
import { SpaceResource } from 'web-client/src/helpers'
import { isProjectSpaceResource, SpaceResource } from 'web-client/src/helpers'
import { WebDAV } from 'web-client/src/webdav'
export default defineComponent({
Expand Down Expand Up @@ -115,6 +116,7 @@ export default defineComponent({
const { webdav } = useClientService()
return {
...useGraphClient(),
isSharedWithMeLocation: useActiveLocation(isLocationSharesActive, 'files-shares-with-me'),
isSharedWithOthersLocation: useActiveLocation(
isLocationSharesActive,
Expand Down Expand Up @@ -237,6 +239,10 @@ export default defineComponent({
this.loadShares()
}
if (isProjectSpaceResource(this.highlightedFile)) {
this.loadSpaceMembers({ graphClient: this.graphClient, space: this.highlightedFile })
}
if (this.isShareLocation || !noChanges) {
this.fetchFileInfo()
}
Expand All @@ -246,6 +252,7 @@ export default defineComponent({
},
methods: {
...mapActions('Files', ['loadSharesTree']),
...mapActions('runtime/spaces', ['loadSpaceMembers']),
async fetchFileInfo() {
this.loading = true
Expand Down
8 changes: 1 addition & 7 deletions packages/web-app-files/src/mixins/actions/showDetails.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mapActions, mapMutations } from 'vuex'
import { mapMutations } from 'vuex'
import { isLocationTrashActive } from '../../router'
import isFilesAppActive from './helpers/isFilesAppActive'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { SideBarEventTopics } from '../../composables/sideBar'
import { isProjectSpaceResource } from 'web-client/src/helpers'
import { useGraphClient } from 'web-pkg/src/composables'

export default {
Expand Down Expand Up @@ -40,13 +39,8 @@ export default {
},
methods: {
...mapMutations('Files', ['SET_FILE_SELECTION']),
...mapActions('runtime/spaces', ['loadSpaceMembers']),

$_showDetails_trigger({ resources }) {
if (resources.length === 1 && isProjectSpaceResource(resources[0])) {
this.loadSpaceMembers({ graphClient: this.graphClient, space: resources[0] })
}

this.SET_FILE_SELECTION(resources)
eventBus.publish(SideBarEventTopics.open)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapActions, mapMutations } from 'vuex'
import { mapMutations } from 'vuex'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { SideBarEventTopics } from '../../../composables/sideBar'
import { useGraphClient } from 'web-pkg/src/composables'
Expand All @@ -24,10 +24,8 @@ export default {
},
methods: {
...mapMutations('Files', ['SET_FILE_SELECTION']),
...mapActions('runtime/spaces', ['loadSpaceMembers']),

$_showMembers_trigger({ resources }) {
this.loadSpaceMembers({ graphClient: this.graphClient, space: resources[0] })
this.SET_FILE_SELECTION(resources)
eventBus.publish(SideBarEventTopics.openWithPanel, 'space-share-item')
}
Expand Down
2 changes: 0 additions & 2 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ export default defineComponent({
},
methods: {
...mapActions(['showMessage']),
...mapActions('runtime/spaces', ['loadSpaceMembers']),
...mapMutations('Files', ['SET_CURRENT_FOLDER', 'SET_FILE_SELECTION']),
getSpaceProjectRoute(space: SpaceResource) {
Expand All @@ -283,7 +282,6 @@ export default defineComponent({
},
openSidebarSharePanel(space: SpaceResource) {
this.loadSpaceMembers({ graphClient: this.graphClient, space })
this.SET_FILE_SELECTION([space])
eventBus.publish(SideBarEventTopics.openWithPanel, 'space-share-item')
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ describe('SharesPanel', () => {
setup: () => {
return {
sharesLoading: sharesLoading,
graphClient: jest.fn(),
loadSpaceMembersTask: jest.fn()
graphClient: jest.fn()
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { defaultComponentMocks } from 'web-test-helpers/src/mocks/defaultCompone
import { defaultStoreMockOptions } from 'web-test-helpers/src/mocks/store/defaultStoreMockOptions'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { SideBarEventTopics } from '../../../../src/composables/sideBar'
import { buildSpace } from 'web-client/src/helpers'

const localVue = createLocalVue()
localVue.use(Vuex)
Expand All @@ -25,15 +24,6 @@ describe('showDetails', () => {
wrapper.vm.$_showDetails_trigger({ resources })
expect(busStub).toHaveBeenCalledWith(SideBarEventTopics.open)
})
it('should load space members if a project space is selected', () => {
const busStub = jest.spyOn(eventBus, 'publish')
const { wrapper } = getWrapper()
const loadSpaceMembersStub = jest.spyOn(wrapper.vm, 'loadSpaceMembers')
const resources = [buildSpace({ id: 1, driveType: 'project' })]
wrapper.vm.$_showDetails_trigger({ resources })
expect(busStub).toHaveBeenCalledWith(SideBarEventTopics.open)
expect(loadSpaceMembersStub).toHaveBeenCalled()
})
})
})

Expand Down

0 comments on commit 10a76c7

Please sign in to comment.