diff --git a/changelog/unreleased/bugfix-space-member-disappearing b/changelog/unreleased/bugfix-space-member-disappearing new file mode 100644 index 00000000000..c8b159978c8 --- /dev/null +++ b/changelog/unreleased/bugfix-space-member-disappearing @@ -0,0 +1,6 @@ +Bugfix: Space member disappearing + +We've fixed a bug where adding links to a space would remove newly added members in the UI. + +https://github.com/owncloud/web/issues/8081 +https://github.com/owncloud/web/pull/8082 diff --git a/packages/web-app-files/src/store/actions.ts b/packages/web-app-files/src/store/actions.ts index 95f4441564d..c91a96da992 100644 --- a/packages/web-app-files/src/store/actions.ts +++ b/packages/web-app-files/src/store/actions.ts @@ -12,7 +12,12 @@ import { ShareTypes } from 'web-client/src/helpers/share' import get from 'lodash-es/get' import { ClipboardActions } from '../helpers/clipboardActions' import { thumbnailService } from '../services' -import { buildResource, Resource, SpaceResource } from 'web-client/src/helpers' +import { + buildResource, + isProjectSpaceResource, + Resource, + SpaceResource +} from 'web-client/src/helpers' import { WebDAV } from 'web-client/src/webdav' import { ClientService } from 'web-pkg/src/services' @@ -192,7 +197,7 @@ export default { }, updateCurrentFileShareTypes({ state, getters, commit }) { const highlighted = getters.highlightedFile - if (!highlighted) { + if (!highlighted || isProjectSpaceResource(highlighted)) { return } commit('UPDATE_RESOURCE_FIELD', { diff --git a/packages/web-app-files/tests/unit/store/actions.spec.ts b/packages/web-app-files/tests/unit/store/actions.spec.ts index 993d1e2f5a2..fabdd89d8bb 100644 --- a/packages/web-app-files/tests/unit/store/actions.spec.ts +++ b/packages/web-app-files/tests/unit/store/actions.spec.ts @@ -2,6 +2,8 @@ import actions from '../../../src/store/actions' import { spaceRoleManager, ShareTypes, Share } from 'web-client/src/helpers/share' import { mockDeep } from 'jest-mock-extended' import { OwnCloudSdk } from 'web-client/src/types' +import { Resource } from 'web-client' +import { SpaceResource } from 'web-client/src/helpers' jest.mock('../../../src/helpers/resources') jest.mock('../../../src/gettext') @@ -98,4 +100,25 @@ describe('vuex store actions', () => { expect(stateMock.commit).toHaveBeenCalledTimes(1) }) }) + + describe('updateCurrentFileShareTypes', () => { + const stateMock = { currentFileOutgoingShares: [] } + const commitSpy = jest.fn() + + it('updates the resource if given', () => { + const getters = { highlightedFile: mockDeep() } + actions.updateCurrentFileShareTypes({ state: stateMock, getters, commit: commitSpy }) + expect(commitSpy).toHaveBeenCalledTimes(1) + }) + it('does not update the resource if not given', () => { + const getters = { highlightedFile: undefined } + actions.updateCurrentFileShareTypes({ state: stateMock, getters, commit: commitSpy }) + expect(commitSpy).toHaveBeenCalledTimes(0) + }) + it('does not update project space resources', () => { + const getters = { highlightedFile: mockDeep({ driveType: 'project' }) } + actions.updateCurrentFileShareTypes({ state: stateMock, getters, commit: commitSpy }) + expect(commitSpy).toHaveBeenCalledTimes(0) + }) + }) })