diff --git a/src/script/conversation/ConversationRepository.ts b/src/script/conversation/ConversationRepository.ts index 9dfc975e8fb..29777e49441 100644 --- a/src/script/conversation/ConversationRepository.ts +++ b/src/script/conversation/ConversationRepository.ts @@ -1754,9 +1754,9 @@ export class ConversationRepository { */ private async removeMembersLocally(conversation: Conversation, userIds: QualifiedId[]) { const currentTimestamp = this.serverTimeHandler.toServerTimestamp(); - const events = userIds.map(userId => EventBuilder.buildMemberLeave(conversation, userId, true, currentTimestamp)); + const event = EventBuilder.buildMemberLeave(conversation, userIds, '', currentTimestamp); // Injecting the event will trigger all the handlers that will then actually remove the users from the conversation - await this.eventRepository.injectEvents(events, EventRepository.SOURCE.INJECTED); + await this.eventRepository.injectEvent(event); } /** @@ -1789,7 +1789,7 @@ export class ConversationRepository { const currentTimestamp = this.serverTimeHandler.toServerTimestamp(); const event = hasResponse ? response.event - : EventBuilder.buildMemberLeave(conversationEntity, user, true, currentTimestamp); + : EventBuilder.buildMemberLeave(conversationEntity, [user], this.userState.self().id, currentTimestamp); this.eventRepository.injectEvent(event, EventRepository.SOURCE.BACKEND_RESPONSE); return event; diff --git a/src/script/conversation/EventBuilder.ts b/src/script/conversation/EventBuilder.ts index 43d6c6b2d74..6b51a7abc1c 100644 --- a/src/script/conversation/EventBuilder.ts +++ b/src/script/conversation/EventBuilder.ts @@ -476,17 +476,17 @@ export const EventBuilder = { buildMemberLeave( conversationEntity: Conversation, - userId: QualifiedId, - removedBySelfUser: boolean, + userIds: QualifiedId[], + from: string, currentTimestamp: number, ): MemberLeaveEvent { return { ...buildQualifiedId(conversationEntity), data: { - qualified_user_ids: [userId], - user_ids: [userId.id], + qualified_user_ids: userIds, + user_ids: userIds.map(({id}) => id), }, - from: removedBySelfUser ? conversationEntity.selfUser().id : userId.id, + from: from, time: conversationEntity.getNextIsoDate(currentTimestamp), type: CONVERSATION_EVENT.MEMBER_LEAVE, }; diff --git a/src/script/entity/message/MemberMessage.ts b/src/script/entity/message/MemberMessage.ts index 82221421dda..a2417a2fb63 100644 --- a/src/script/entity/message/MemberMessage.ts +++ b/src/script/entity/message/MemberMessage.ts @@ -226,7 +226,7 @@ export class MemberMessage extends SystemMessage { } const allUsers = this.generateNameString(); - if (!this.user().isMe && !name) { + if (!this.user().id) { return t('conversationMemberWereRemoved', allUsers); } return this.user().isMe