diff --git a/changelog/unreleased/bugfix-re-loading-space-members b/changelog/unreleased/bugfix-re-loading-space-members
new file mode 100644
index 00000000000..5eef65be039
--- /dev/null
+++ b/changelog/unreleased/bugfix-re-loading-space-members
@@ -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
diff --git a/changelog/unreleased/enhancement-share-group-members b/changelog/unreleased/enhancement-share-group-members
index 4b32bff3dbd..db89902d624 100644
--- a/changelog/unreleased/enhancement-share-group-members
+++ b/changelog/unreleased/enhancement-share-group-members
@@ -13,5 +13,7 @@ In detail it contains:
* All users / groups who only have access on a share level inside a sub-resource of a space can not see all groups which are regular members of the space
https://github.com/owncloud/web/pull/8161
+https://github.com/owncloud/web/pull/8300
https://github.com/owncloud/web/issues/8160
https://github.com/owncloud/web/issues/8177
+https://github.com/owncloud/web/issues/8299
diff --git a/packages/web-app-files/src/components/SideBar/SideBar.vue b/packages/web-app-files/src/components/SideBar/SideBar.vue
index f11030df32d..41f39b7de95 100644
--- a/packages/web-app-files/src/components/SideBar/SideBar.vue
+++ b/packages/web-app-files/src/components/SideBar/SideBar.vue
@@ -27,6 +27,7 @@
/>
@@ -219,6 +220,9 @@ export default defineComponent({
this.isSharedWithOthersLocation ||
this.isSharedViaLinkLocation
)
+ },
+ spaceResource() {
+ return this.spaces.find((s) => s.id === this.highlightedFile.id)
}
},
watch: {
@@ -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) {
diff --git a/packages/web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue b/packages/web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue
index 32affc24d93..3ad55258b90 100644
--- a/packages/web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue
+++ b/packages/web-pkg/src/components/sideBar/Spaces/SpaceInfo.vue
@@ -4,23 +4,20 @@
-
-
+
+
diff --git a/packages/web-pkg/tests/unit/components/sidebar/Spaces/SpaceInfo.spec.ts b/packages/web-pkg/tests/unit/components/sidebar/Spaces/SpaceInfo.spec.ts
index f117057b296..2cd7c302bf5 100644
--- a/packages/web-pkg/tests/unit/components/sidebar/Spaces/SpaceInfo.spec.ts
+++ b/packages/web-pkg/tests/unit/components/sidebar/Spaces/SpaceInfo.spec.ts
@@ -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',
@@ -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()]
}
})
}
diff --git a/packages/web-runtime/src/store/spaces.ts b/packages/web-runtime/src/store/spaces.ts
index dfea3f2cb67..e0287850a61 100644
--- a/packages/web-runtime/src/store/spaces.ts
+++ b/packages/web-runtime/src/store/spaces.ts
@@ -1,7 +1,6 @@
import { buildSpace, isProjectSpaceResource, SpaceResource } from 'web-client/src/helpers'
-import { Ref } from 'vue'
+import { Ref, unref } from 'vue'
import { set, has } from 'lodash-es'
-import { unref } from 'vue'
import { buildSpaceShare } from 'web-client/src/helpers/share'
import { sortSpaceMembers } from '../helpers/space/sortMembers'
@@ -88,8 +87,10 @@ const mutations = {
state.spaceMembers = members
},
UPSERT_SPACE_MEMBERS(state, member) {
+ // group shares don't have the name prop... distinguish by shareType
+ const checkAttr = member.collaborator.name ? 'name' : 'displayName'
const memberIndex = state.spaceMembers.findIndex((s) => {
- return member.id === s.id && member.collaborator.name === s.collaborator.name
+ return member.id === s.id && member.collaborator[checkAttr] === s.collaborator[checkAttr]
})
if (memberIndex >= 0) {
@@ -100,8 +101,10 @@ const mutations = {
}
},
REMOVE_SPACE_MEMBER(state, member) {
+ // group shares don't have the name prop... distinguish by shareType
+ const checkAttr = member.collaborator.name ? 'name' : 'displayName'
state.spaceMembers = state.spaceMembers.filter(
- (s) => member.id === s.id && member.collaborator.name !== s.collaborator.name
+ (s) => member.id === s.id && member.collaborator[checkAttr] !== s.collaborator[checkAttr]
)
}
}