diff --git a/packages/state-manager/src/sagas/communities/saveCommunityMetadata/saveCommunityMetadata.saga.ts b/packages/state-manager/src/sagas/communities/saveCommunityMetadata/saveCommunityMetadata.saga.ts deleted file mode 100644 index 34d842cd08..0000000000 --- a/packages/state-manager/src/sagas/communities/saveCommunityMetadata/saveCommunityMetadata.saga.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { type PayloadAction } from '@reduxjs/toolkit' -import { put, select } from 'typed-redux-saga' -import { type Socket } from '../../../types' -import { publicChannelsActions } from '../../publicChannels/publicChannels.slice' -import { communitiesSelectors } from '../communities.selectors' -import { communitiesActions } from '../communities.slice' -import createLogger from '../../../utils/logger' - -const logger = createLogger('communities') - -export function* saveCommunityMetadataSaga( - socket: Socket, - action: PayloadAction['payload']> -): Generator { - const communityId = yield* select(communitiesSelectors.currentCommunityId) - logger.info(`save community metadata: ${action.payload}`) - yield* put( - communitiesActions.updateCommunity({ - id: communityId, - rootCa: action.payload.rootCa, - ownerOrbitDbIdentity: action.payload.ownerOrbitDbIdentity, - ownerCertificate: action.payload.ownerCertificate, - }) - ) -} diff --git a/packages/state-manager/src/sagas/communities/updateCommunity/updateCommunity.saga.ts b/packages/state-manager/src/sagas/communities/updateCommunity/updateCommunity.saga.ts deleted file mode 100644 index d3f0af8620..0000000000 --- a/packages/state-manager/src/sagas/communities/updateCommunity/updateCommunity.saga.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { call, put } from 'typed-redux-saga' -import { type Certificate } from 'pkijs' - -import { CertFieldsTypes, getCertFieldValue, loadCertificate } from '@quiet/identity' -import { type PayloadAction } from '@reduxjs/toolkit' - -import { communitiesActions } from '../communities.slice' - -import createLogger from '../../../utils/logger' - -const logger = createLogger('communities') - -export function* updateCommunitySaga( - action: PayloadAction['payload']> -): Generator { - let rootCa: Certificate - let communityName: string | null = null - - if (action.payload.rootCa) { - rootCa = loadCertificate(action.payload.rootCa) - communityName = yield* call(getCertFieldValue, rootCa, CertFieldsTypes.commonName) - - if (!communityName) { - logger.error(`Could not retrieve ${CertFieldsTypes.commonName} from rootca`) - } - } - - const payload: { - id: string - name?: string - rootCa?: string - ownerCertificate?: string - ownerOrbitDbIdentity?: string - } = { - id: action.payload.id, - } - - if (communityName) { - payload.name = communityName - } - - if (action.payload.rootCa) { - payload.rootCa = action.payload.rootCa - } - - if (action.payload.ownerOrbitDbIdentity) { - payload.ownerOrbitDbIdentity = action.payload.ownerOrbitDbIdentity - } - - if (action.payload.ownerCertificate) { - payload.ownerCertificate = action.payload.ownerCertificate - } - - yield* put(communitiesActions.updateCommunityData(payload)) -}