crypto: Only add our own devices if we're requesting devices for our own user

This commit is contained in:
Damir Jelić 2021-07-08 16:51:57 +02:00
parent 80e80e07b3
commit d4090c4b0a

View file

@ -619,12 +619,15 @@ internal class OlmMachine(
*/ */
@Throws(CryptoStoreErrorException::class) @Throws(CryptoStoreErrorException::class)
suspend fun getUserDevices(userId: String): List<CryptoDeviceInfo> { suspend fun getUserDevices(userId: String): List<CryptoDeviceInfo> {
val ownDevice = ownDevice()
val devices = inner.getUserDevices(userId).map { toCryptoDeviceInfo(it) }.toMutableList() val devices = inner.getUserDevices(userId).map { toCryptoDeviceInfo(it) }.toMutableList()
// EA doesn't differentiate much between our own and other devices of // EA doesn't differentiate much between our own and other devices of
// while the rust-sdk does, append our own device here. // 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 return devices
} }