Code review

This commit is contained in:
Valere 2020-04-30 11:38:32 +02:00
parent 5840248ffa
commit 05230a6afa
1 changed files with 2 additions and 3 deletions

View File

@ -34,17 +34,16 @@ internal interface ComputeTrustTask : Task<ComputeTrustTask.Params, RoomEncrypti
internal class DefaultComputeTrustTask @Inject constructor(
private val cryptoStore: IMXCryptoStore,
@UserId private val myUserId: String,
@UserId private val userId: String,
private val coroutineDispatchers: MatrixCoroutineDispatchers
) : ComputeTrustTask {
override suspend fun execute(params: ComputeTrustTask.Params): RoomEncryptionTrustLevel = withContext(coroutineDispatchers.crypto) {
// The set of “all users” depends on the type of room:
// For regular / topic rooms, all users including yourself, are considered when decorating a room
// For 1:1 and group DM rooms, all other users (i.e. excluding yourself) are considered when decorating a room
val listToCheck = if (params.isDirectRoom) {
params.activeMemberUserIds.filter { it != myUserId }
params.activeMemberUserIds.filter { it != userId }
} else {
params.activeMemberUserIds
}