Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disappearing space members when adding links #8082

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-space-member-disappearing
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions packages/web-app-files/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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', {
Expand Down
23 changes: 23 additions & 0 deletions packages/web-app-files/tests/unit/store/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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<Resource>() }
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<SpaceResource>({ driveType: 'project' }) }
actions.updateCurrentFileShareTypes({ state: stateMock, getters, commit: commitSpy })
expect(commitSpy).toHaveBeenCalledTimes(0)
})
})
})