Skip to content

Commit

Permalink
handle pure MemberLeaveReason.USER_DELETED
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisamir98 committed Jan 18, 2024
1 parent 43798b7 commit 3edd9bc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/script/conversation/ConversationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
MessageSendingStatus,
RemoteConversations,
} from '@wireapp/api-client/lib/conversation';
import {ConversationReceiptModeUpdateData} from '@wireapp/api-client/lib/conversation/data/';
import {MemberLeaveReason, ConversationReceiptModeUpdateData} from '@wireapp/api-client/lib/conversation/data';
import {CONVERSATION_TYPING} from '@wireapp/api-client/lib/conversation/data/ConversationTypingData';
import {
ConversationCreateEvent,
Expand Down Expand Up @@ -2998,6 +2998,19 @@ export class ConversationRepository {
return this.onMemberJoin(conversationEntity, eventJson);

case CONVERSATION_EVENT.MEMBER_LEAVE:
if (eventJson.data.reason === MemberLeaveReason.USER_DELETED) {
eventJson.data.qualified_user_ids?.forEach(qualifiedUserId => {
const user = this.userState.users().find(user => matchQualifiedIds(user.qualifiedId, qualifiedUserId));
if (!user?.teamId) {
return;
}

void this.teamMemberLeave(user?.teamId, user?.qualifiedId, new Date(eventJson.time).getTime());
});
return;
}
return this.onMemberLeave(conversationEntity, eventJson);

case ClientEvent.CONVERSATION.TEAM_MEMBER_LEAVE:
return this.onMemberLeave(conversationEntity, eventJson);

Expand Down

0 comments on commit 3edd9bc

Please sign in to comment.