1
0
mirror of https://github.com/owncloud/ocis.git synced 2026-10-23 23:29:02 +03:00

fix(web): [OCISDEV-1555] remove federated connections in the OCM connections panel (#13160)

This commit is contained in:
Matteo
2026-10-15 18:38:31 +02:00
committed by GitHub
parent c9856ef000
commit 408c41dc83
6 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
Bugfix: Remove federated connections
Removing a federated connection in the connections panel sent a malformed
request to the server, so the connection was not actually removed and could
reappear after a page reload.
The request is now sent correctly and the connection is removed for good.
https://github.com/owncloud/ocis/pull/13160

View File

@@ -3,6 +3,9 @@
"version": "0.0.0",
"description": "OCM",
"license": "Apache-2.0",
"devDependencies": {
"@ownclouders/web-test-helpers": "workspace:*"
},
"peerDependencies": {
"@ownclouders/design-system": "workspace:*",
"@ownclouders/web-client": "workspace:*",

View File

@@ -158,7 +158,8 @@ const toSharedWithOthers = () => {
const deleteConnection = async (user: FederatedConnection) => {
try {
await clientService.httpAuthenticated.delete('/sciencemesh/delete-accepted-user', {
data: { user_id: user.user_id, idp: user.idp }
user_id: user.user_id,
idp: user.idp
})
const updatedConnections = connections.filter(({ id }) => id !== buildConnection(user).id)

View File

@@ -0,0 +1,41 @@
import {
defaultComponentMocks,
defaultPlugins,
mockHttpResponse,
shallowMount
} from '@ownclouders/web-test-helpers'
import { FederatedConnection } from '@ownclouders/web-pkg'
import ConnectionsPanel from '../../../src/views/ConnectionsPanel.vue'
describe('ConnectionsPanel', () => {
describe('deleteConnection', () => {
it('sends the user id and idp as the request body', async () => {
const { wrapper, mocks } = getWrapper()
const connection = { id: 'c1', user_id: 'einstein', idp: 'https://idp.example.org' }
await (wrapper.vm as any).deleteConnection(connection)
expect(mocks.$clientService.httpAuthenticated.delete).toHaveBeenCalledWith(
'/sciencemesh/delete-accepted-user',
{ user_id: 'einstein', idp: 'https://idp.example.org' }
)
})
})
})
function getWrapper() {
const mocks = defaultComponentMocks()
mocks.$clientService.httpAuthenticated.delete.mockResolvedValue(mockHttpResponse({}))
return {
mocks,
wrapper: shallowMount(ConnectionsPanel, {
props: { connections: [] as FederatedConnection[], loading: false },
global: {
plugins: [...defaultPlugins()],
mocks,
provide: mocks
}
})
}
}

View File

@@ -0,0 +1,11 @@
import { defineProject, mergeConfig } from 'vitest/config'
import configShared from '../../tests/unit/config/vitest.config'
export default mergeConfig(
configShared,
defineProject({
test: {
name: 'web-app-ocm'
}
})
)

4
web/pnpm-lock.yaml generated
View File

@@ -812,6 +812,10 @@ importers:
zod:
specifier: 4.3.6
version: 4.3.6
devDependencies:
'@ownclouders/web-test-helpers':
specifier: workspace:*
version: link:../web-test-helpers
packages/web-app-password-protected-folders:
devDependencies: