Skip to content

Commit 96cc375

Browse files
author
Thomas Belin
authored
runfix(core): Call the correct endpoint to add federated users to conv (#12049)
1 parent 377a546 commit 96cc375

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/script/conversation/ConversationRepository.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,11 @@ export class ConversationRepository {
12771277
const userIds = userEntities.map(userEntity => userEntity.qualifiedId);
12781278

12791279
try {
1280-
const response = await this.conversation_service.postMembers(conversationEntity.id, userIds);
1280+
const response = await this.conversation_service.postMembers(
1281+
conversationEntity.id,
1282+
userIds,
1283+
conversationEntity.isFederated(),
1284+
);
12811285
if (response) {
12821286
this.eventRepository.injectEvent(response, EventRepository.SOURCE.BACKEND_RESPONSE);
12831287
}

src/script/conversation/ConversationService.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,17 @@ export class ConversationService {
350350
* @param userIds IDs of users to be added to the conversation
351351
* @returns Resolves with the server response
352352
*/
353-
postMembers(conversationId: string, userIds: QualifiedId[]): Promise<ConversationMemberJoinEvent> {
354-
return this.apiClient.conversation.api.postMembers(
355-
conversationId,
356-
userIds.map(({id}) => id),
357-
);
353+
postMembers(
354+
conversationId: string,
355+
userIds: QualifiedId[],
356+
useFederation: boolean,
357+
): Promise<ConversationMemberJoinEvent> {
358+
return useFederation
359+
? this.apiClient.conversation.api.postMembersV2(conversationId, userIds)
360+
: this.apiClient.conversation.api.postMembers(
361+
conversationId,
362+
userIds.map(({id}) => id),
363+
);
358364
}
359365

360366
//##############################################################################

0 commit comments

Comments
 (0)