Skip to content

Commit

Permalink
Fix re-loading the spaces members panel
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Jan 24, 2023
1 parent 5ded076 commit 7714ba8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-re-loading-space-members
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Re-loading space members panel

We've fixed a bug where re-loading the members panel for a space would remove recently added members in the UI.

https://github.com/owncloud/web/pull/8300
https://github.com/owncloud/web/issues/8298
6 changes: 5 additions & 1 deletion packages/web-app-files/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/>
<space-info
v-if="isSingleResource && highlightedFileIsSpace"
:space-resource="spaceResource"
class="sidebar-panel__space_info"
/>
</template>
Expand Down Expand Up @@ -219,6 +220,9 @@ export default defineComponent({
this.isSharedWithOthersLocation ||
this.isSharedViaLinkLocation
)
},
spaceResource() {
return this.spaces.find((s) => s.id === this.highlightedFile.id)
}
},
watch: {
Expand All @@ -238,7 +242,7 @@ export default defineComponent({
}
if (isProjectSpaceResource(this.highlightedFile)) {
this.loadSpaceMembers({ graphClient: this.graphClient, space: this.highlightedFile })
this.loadSpaceMembers({ graphClient: this.graphClient, space: this.spaceResource })
}
if (this.isShareLocation || !noChanges) {
Expand Down
14 changes: 3 additions & 11 deletions packages/web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<div class="oc-mr-s">
<oc-icon
name="layout-grid"
:size="space.description ? 'large' : 'medium'"
:size="spaceResource.description ? 'large' : 'medium'"
class="oc-display-block"
/>
</div>
<div>
<h3 data-testid="space-info-name" v-text="space.name" />
<span data-testid="space-info-subtitle" v-text="space.description" />
<h3 data-testid="space-info-name" v-text="spaceResource.name" />
<span data-testid="space-info-subtitle" v-text="spaceResource.description" />
</div>
</div>
</div>
Expand All @@ -19,7 +19,6 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
import { PropType } from 'vue'
import { SpaceResource } from 'web-client'
Expand All @@ -30,13 +29,6 @@ export default defineComponent({
type: Object as PropType<SpaceResource>,
required: false
}
},
computed: {
...mapGetters('Files', ['highlightedFile']),
space() {
return this.spaceResource || this.highlightedFile
}
}
})
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import SpaceInfo from 'web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue'
import {
createStore,
defaultPlugins,
shallowMount,
defaultStoreMockOptions
} from 'web-test-helpers'
import { defaultPlugins, shallowMount } from 'web-test-helpers'

const spaceMock = {
type: 'space',
Expand All @@ -31,14 +26,11 @@ describe('SpaceInfo', () => {
})

function createWrapper(spaceResource) {
const storeOptions = { ...defaultStoreMockOptions }
storeOptions.modules.Files.getters.highlightedFile.mockImplementation(() => spaceResource)
const store = createStore(storeOptions)

return {
wrapper: shallowMount(SpaceInfo, {
props: { spaceResource },
global: {
plugins: [...defaultPlugins(), store]
plugins: [...defaultPlugins()]
}
})
}
Expand Down

0 comments on commit 7714ba8

Please sign in to comment.