From ff3a916cabc991d8191525ebeb25b1a13371cc0f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 20 Apr 2021 18:59:49 +0200 Subject: [PATCH] Do not invite the current user when creating a room (#3123) --- CHANGES.md | 1 + .../internal/session/room/create/CreateRoomBodyBuilder.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f2c5fb5d11..94ceb85fbd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Improvements 🙌: Bugfix 🐛: - Message states cosmetic changes (#3007) - Fix exception in rxSingle (#3180) + - Do not invite the current user when creating a room (#3123) Translations 🗣: - diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/create/CreateRoomBodyBuilder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/create/CreateRoomBodyBuilder.kt index 5e823fc87f..80be49de61 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/create/CreateRoomBodyBuilder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/create/CreateRoomBodyBuilder.kt @@ -27,6 +27,7 @@ import org.matrix.android.sdk.api.util.MimeTypes import org.matrix.android.sdk.internal.crypto.DeviceListManager import org.matrix.android.sdk.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM import org.matrix.android.sdk.internal.di.AuthenticatedIdentity +import org.matrix.android.sdk.internal.di.UserId import org.matrix.android.sdk.internal.network.token.AccessTokenProvider import org.matrix.android.sdk.internal.session.content.FileUploader import org.matrix.android.sdk.internal.session.identity.EnsureIdentityTokenTask @@ -43,6 +44,8 @@ internal class CreateRoomBodyBuilder @Inject constructor( private val deviceListManager: DeviceListManager, private val identityStore: IdentityStore, private val fileUploader: FileUploader, + @UserId + private val userId: String, @AuthenticatedIdentity private val accessTokenProvider: AccessTokenProvider ) { @@ -80,7 +83,7 @@ internal class CreateRoomBodyBuilder @Inject constructor( roomAliasName = params.roomAliasName, name = params.name, topic = params.topic, - invitedUserIds = params.invitedUserIds, + invitedUserIds = params.invitedUserIds.filter { it != userId }, invite3pids = invite3pids, creationContent = params.creationContent.takeIf { it.isNotEmpty() }, initialStates = initialStates,