Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc committed Oct 10, 2023
1 parent 9cc7250 commit 8299f89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/script/conversation/ConversationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,13 +1751,20 @@ export class ConversationRepository {
: this.removeMembers(conversation, [userQualifiedId]);
}

/**
* Will inject a `member-leave` that will then trigger the local removal of the user in the conversation
* @param conversation the conversation in which we want to remove users
* @param userIds the users to remove from the conversation
*/
private async removeMembersLocally(conversation: Conversation, userIds: QualifiedId[]) {
const currentTimestamp = this.serverTimeHandler.toServerTimestamp();
const events = userIds.map(userId => EventBuilder.buildMemberLeave(conversation, userId, true, 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);
}

/**
* Umbrella function to remove a member from a conversation, no matter the protocol or type.
* Umbrella function to remove a member from a conversation (from backend and locally), no matter the protocol or type.
*
* @param conversationEntity Conversation to remove member from
* @param userId ID of member to be removed from the conversation
Expand Down

0 comments on commit 8299f89

Please sign in to comment.