Fix legacy user not showing and duplicates not handled when UUID format was different

This commit is contained in:
Niels van Velzen
2020-11-28 13:29:40 +01:00
parent c4dea67647
commit 876d87631d

View File

@@ -76,7 +76,7 @@ class ServerRepositoryImpl(
private fun getLegacyUsersForServer(server: Server): Flow<User> = flow {
val user = credentialsFileSource.read()?.user ?: return@flow
if (user.serverId == server.id) emit(user)
if (user.serverId.toUUID() == server.id.toUUID()) emit(user)
}
@OptIn(ExperimentalCoroutinesApi::class)
@@ -92,7 +92,7 @@ class ServerRepositoryImpl(
emitAll(getPublicUsersForServer(server))
if (stored) emitAll(getStoredUsersForServer(server))
if (legacy) emitAll(getLegacyUsersForServer(server))
}.distinctUntilChangedBy { it.id }.toList()
}.distinctUntilChangedBy { it.id.toUUID() }.toList()
Pair(server, users)
}