diff --git a/src/lib/chat/index.ts b/src/lib/chat/index.ts index ca227b12a..a3de00e0a 100644 --- a/src/lib/chat/index.ts +++ b/src/lib/chat/index.ts @@ -74,7 +74,6 @@ export interface IChatClient { mentionedUserIds: string[], data?: Partial ): Promise; - userJoinedInviterOnZero: (channelId: string, inviterId: string, inviteeId: string) => Promise; markRoomAsRead: (roomId: string, userId?: string) => Promise; getSecureBackup: () => Promise; generateSecureBackup: () => Promise; @@ -147,10 +146,6 @@ export class Chat { return this.client.deleteMessageByRoomId(roomId, messageId); } - async userJoinedInviterOnZero(channelId: string, inviterId: string, inviteeId: string) { - return this.client.userJoinedInviterOnZero(channelId, inviterId, inviteeId); - } - async editMessage( roomId: string, messageId: string, diff --git a/src/lib/chat/matrix-client.ts b/src/lib/chat/matrix-client.ts index 3b160a0bb..e9fd04339 100644 --- a/src/lib/chat/matrix-client.ts +++ b/src/lib/chat/matrix-client.ts @@ -381,7 +381,6 @@ export class MatrixClient implements IChatClient { case EventType.RoomMessage: return mapMatrixMessage(event, this.matrix); - case CustomEventType.USER_JOINED_INVITER_ON_ZERO: case EventType.RoomCreate: return mapEventToAdminMessage(event); @@ -714,13 +713,6 @@ export class MatrixClient implements IChatClient { return await this.mapConversation(room); } - async userJoinedInviterOnZero(channelId: string, inviterId: string, inviteeId: string) { - this.matrix.sendEvent(channelId, CustomEventType.USER_JOINED_INVITER_ON_ZERO as any, { - inviterId, - inviteeId, - }); - } - mxcUrlToHttp(mxcUrl: string, isThumbnail: boolean = false): string { const height = isThumbnail ? 96 : undefined; const width = isThumbnail ? 96 : undefined; diff --git a/src/lib/chat/matrix/chat-message.ts b/src/lib/chat/matrix/chat-message.ts index 2ae83dca4..67ac65525 100644 --- a/src/lib/chat/matrix/chat-message.ts +++ b/src/lib/chat/matrix/chat-message.ts @@ -144,8 +144,6 @@ export async function mapEventToPostMessage(matrixMessage, sdkMatrixClient: SDKM function getAdminDataFromEventType(type, content, sender, targetUserId, previousContent) { switch (type) { - case CustomEventType.USER_JOINED_INVITER_ON_ZERO: - return { type: AdminMessageType.JOINED_ZERO, inviterId: content.inviterId, inviteeId: content.inviteeId }; case EventType.RoomMember: return getRoomMemberAdminData(content, targetUserId, previousContent); case EventType.RoomCreate: diff --git a/src/store/registration/saga.test.ts b/src/store/registration/saga.test.ts index a75d875f7..bc410c1f5 100644 --- a/src/store/registration/saga.test.ts +++ b/src/store/registration/saga.test.ts @@ -38,7 +38,6 @@ import { completeUserLogin } from '../authentication/saga'; import { createConversation } from '../channels-list/saga'; import { denormalize as denormalizeUser } from '../users'; import { StoreBuilder } from '../test/store'; -import { chat } from '../../lib/chat'; describe('validate invite', () => { it('validates invite code, returns true if VALID', async () => { @@ -508,13 +507,10 @@ describe('authorizeAndCreateWeb3Account', () => { }); describe(createWelcomeConversation, () => { - const chatClient = { userJoinedInviterOnZero: jest.fn() }; - function subject(...args: Parameters) { return expectSaga(...args).provide([ [matchers.call.fn(getZEROUsersAPI), [{ userId: 'stub-id' }]], [matchers.call.fn(createConversation), { id: 'conversation-id' }], - [matchers.call.fn(chat.get), chatClient], ]); } it('creates the welcome conversation between the inviter and new user', async () => { @@ -524,7 +520,6 @@ describe(createWelcomeConversation, () => { .provide([[call(getZEROUsersAPI, ['inviter-matrix-id']), [{ userId: 'inviter-id', firstName: 'The inviter' }]]]) .withReducer(rootReducer, initialState.build()) .call(createConversation, ['inviter-id'], '', null) - .call([chatClient, chatClient.userJoinedInviterOnZero], 'conversation-id', 'inviter-id', 'new-user-id') .run(); }); diff --git a/src/store/registration/saga.ts b/src/store/registration/saga.ts index e6a9f96fb..1b5814643 100644 --- a/src/store/registration/saga.ts +++ b/src/store/registration/saga.ts @@ -30,7 +30,6 @@ import { getHistory } from '../../lib/browser'; import { setIsComplete as setPageLoadComplete } from '../page-load'; import { createConversation } from '../channels-list/saga'; import { getZEROUsers as getZEROUsersAPI } from '../channels-list/api'; -import { chat } from '../../lib/chat'; import { getProvider as getIndexedDbProvider } from '../../lib/storage/idb'; import { receive as receiveUser } from '../users'; @@ -251,12 +250,7 @@ export function* createWelcomeConversation(userId: string, inviter: { id: string const inviterZeroUserData = yield call(getZEROUsersAPI, [inviter.matrixId]); const inviterUser = inviterZeroUserData?.[0]; yield put(receiveUser(inviterUser)); - - const createdConversation = yield call(createConversation, [inviterUser.userId], '', null); - const createdConversationId = createdConversation.id; - - const chatClient = yield call(chat.get); - yield call([chatClient, chatClient.userJoinedInviterOnZero], createdConversationId, inviterUser.userId, userId); + yield call(createConversation, [inviterUser.userId], '', null); } catch (error) {} }