Skip to content

Commit

Permalink
chore: don't clear invitation data from Community
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Apr 24, 2024
1 parent 68313c2 commit 29d289a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CryptoEngine, setEngine } from 'pkijs'
import { getLibp2pAddressesFromCsrs, removeFilesFromDir } from '../common/utils'

import { LazyModuleLoader } from '@nestjs/core'
import { createLibp2pAddress, isPSKcodeValid, p2pAddressesToPairs } from '@quiet/common'
import { createLibp2pAddress, isPSKcodeValid } from '@quiet/common'
import { CertFieldsTypes, getCertFieldValue, loadCertificate } from '@quiet/identity'
import {
ChannelMessageIdsResponse,
Expand Down Expand Up @@ -520,7 +520,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
// Unblock websocket endpoints
this.socketService.resolveReadyness()

await this.localDbService.deleteInviteData()
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_LAUNCHED, { id: community.id })
}

Expand Down
9 changes: 0 additions & 9 deletions packages/backend/src/nest/local-db/local-db.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,6 @@ export class LocalDbService {
return communityId in ((await this.getCommunities()) ?? {})
}

public async deleteInviteData() {
const community = await this.getCurrentCommunity()
if (!community) throw new Error('No community found')
if (!community.inviteData) return
this.logger(`Deleting invite data from community ${community.id}`)
const updatedCommunity = { ...community, inviteData: null }
await this.setCommunity(updatedCommunity)
}

// These are potentially temporary functions to help us migrate data to the
// backend. Currently this information lives under the COMMUNITY key in
// LevelDB, but on the frontend this data lives in the Identity model. So we
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/src/rtl-tests/community.create.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ describe('User', () => {
"Files/checkForMissingFiles",
"Network/addInitializedCommunity",
"Communities/clearInvitationCodes",
"Communities/clearInvitationData",
"PublicChannels/channelsReplicated",
"Communities/updateCommunityData",
"PublicChannels/addChannel",
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/src/rtl-tests/community.join.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ describe('User', () => {
"Files/checkForMissingFiles",
"Network/addInitializedCommunity",
"Communities/clearInvitationCodes",
"Communities/clearInvitationData",
"PublicChannels/channelsReplicated",
"PublicChannels/setChannelSubscribed",
"PublicChannels/addChannel",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import { createSlice, type EntityState, type PayloadAction } from '@reduxjs/toolkit'
import { StoreKeys } from '../store.keys'
import { communitiesAdapter } from './communities.adapter'
import {
InvitationPair,
type AddOwnerCertificatePayload,
type Community,
type CreateNetworkPayload,
type StorePeerListPayload,
CommunityMetadata,
InvitationData,
} from '@quiet/types'
import { InvitationPair, type Community, type CreateNetworkPayload } from '@quiet/types'

export class CommunitiesState {
public invitationCodes: InvitationPair[] = []
Expand Down Expand Up @@ -46,14 +38,6 @@ export const communitiesSlice = createSlice({
clearInvitationCodes: state => {
state.invitationCodes = []
},
clearInvitationData: (state, action: PayloadAction<string>) => {
communitiesAdapter.updateOne(state.communities, {
id: action.payload,
changes: {
inviteData: null,
},
})
},
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function subscribe(socket: Socket) {
| ReturnType<typeof connectionActions.setTorInitialized>
| ReturnType<typeof usersActions.setUserProfiles>
| ReturnType<typeof appActions.loadMigrationData>
| ReturnType<typeof communitiesActions.clearInvitationData>
>(emit => {
// UPDATE FOR APP
socket.on(SocketActionTypes.TOR_INITIALIZED, () => {
Expand Down Expand Up @@ -142,7 +141,6 @@ export function subscribe(socket: Socket) {
emit(filesActions.checkForMissingFiles(payload.id))
emit(networkActions.addInitializedCommunity(payload.id))
emit(communitiesActions.clearInvitationCodes())
emit(communitiesActions.clearInvitationData(payload.id))
})

socket.on(SocketActionTypes.COMMUNITY_UPDATED, (payload: Community) => {
Expand Down

0 comments on commit 29d289a

Please sign in to comment.