From d4090c4b0a0cb93d14481898e0350fe797b483e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 8 Jul 2021 16:51:57 +0200 Subject: [PATCH] crypto: Only add our own devices if we're requesting devices for our own user --- .../org/matrix/android/sdk/internal/crypto/OlmMachine.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index 96eda6a465..3d555cc8e1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -619,12 +619,15 @@ internal class OlmMachine( */ @Throws(CryptoStoreErrorException::class) suspend fun getUserDevices(userId: String): List { - val ownDevice = ownDevice() val devices = inner.getUserDevices(userId).map { toCryptoDeviceInfo(it) }.toMutableList() // EA doesn't differentiate much between our own and other devices of // while the rust-sdk does, append our own device here. - devices.add(ownDevice) + val ownDevice = this.ownDevice() + + if (userId == ownDevice.userId) { + devices.add(ownDevice) + } return devices }