mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
use correct primary key to search for any other users in the DB and use current value from user attributes object
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
6a8cafec22
commit
00f55f1949
@ -71,8 +71,8 @@ abstract class UsersDao {
|
|||||||
@Query("SELECT * FROM User where userId = :userId")
|
@Query("SELECT * FROM User where userId = :userId")
|
||||||
abstract fun getUserWithUserId(userId: String): Maybe<UserEntity>
|
abstract fun getUserWithUserId(userId: String): Maybe<UserEntity>
|
||||||
|
|
||||||
@Query("SELECT * FROM User where userId != :userId")
|
@Query("SELECT * FROM User where id != :id")
|
||||||
abstract fun getUsersWithoutUserId(userId: Long): Single<List<UserEntity>>
|
abstract fun getUsersWithoutId(id: Long): Single<List<UserEntity>>
|
||||||
|
|
||||||
@Query("SELECT * FROM User where scheduledForDeletion = 1")
|
@Query("SELECT * FROM User where scheduledForDeletion = 1")
|
||||||
abstract fun getUsersScheduledForDeletion(): Single<List<UserEntity>>
|
abstract fun getUsersScheduledForDeletion(): Single<List<UserEntity>>
|
||||||
|
@ -33,7 +33,7 @@ interface UsersRepository {
|
|||||||
fun getUserWithId(id: Long): Maybe<User>
|
fun getUserWithId(id: Long): Maybe<User>
|
||||||
fun getUserWithIdNotScheduledForDeletion(id: Long): Maybe<User>
|
fun getUserWithIdNotScheduledForDeletion(id: Long): Maybe<User>
|
||||||
fun getUserWithUserId(userId: String): Maybe<User>
|
fun getUserWithUserId(userId: String): Maybe<User>
|
||||||
fun getUsersWithoutUserId(userId: Long): Single<List<User>>
|
fun getUsersWithoutUserId(id: Long): Single<List<User>>
|
||||||
fun getUsersScheduledForDeletion(): Single<List<User>>
|
fun getUsersScheduledForDeletion(): Single<List<User>>
|
||||||
fun getUsersNotScheduledForDeletion(): Single<List<User>>
|
fun getUsersNotScheduledForDeletion(): Single<List<User>>
|
||||||
fun getUserWithUsernameAndServer(username: String, server: String): Maybe<User>
|
fun getUserWithUsernameAndServer(username: String, server: String): Maybe<User>
|
||||||
|
@ -49,8 +49,8 @@ class UsersRepositoryImpl(private val usersDao: UsersDao) : UsersRepository {
|
|||||||
return usersDao.getUserWithUserId(userId).map { UserMapper.toModel(it) }
|
return usersDao.getUserWithUserId(userId).map { UserMapper.toModel(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUsersWithoutUserId(userId: Long): Single<List<User>> {
|
override fun getUsersWithoutUserId(id: Long): Single<List<User>> {
|
||||||
return usersDao.getUsersWithoutUserId(userId).map { UserMapper.toModel(it) }
|
return usersDao.getUsersWithoutId(id).map { UserMapper.toModel(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUsersScheduledForDeletion(): Single<List<User>> {
|
override fun getUsersScheduledForDeletion(): Single<List<User>> {
|
||||||
|
@ -57,8 +57,8 @@ class UserManager internal constructor(private val userRepository: UsersReposito
|
|||||||
return userRepository.getUserWithId(id)
|
return userRepository.getUserWithId(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun disableAllUsersWithoutId(userId: Long): Single<Int> {
|
fun disableAllUsersWithoutId(id: Long): Single<Int> {
|
||||||
val results = userRepository.getUsersWithoutUserId(userId)
|
val results = userRepository.getUsersWithoutUserId(id)
|
||||||
|
|
||||||
return results.map { users ->
|
return results.map { users ->
|
||||||
var count = 0
|
var count = 0
|
||||||
@ -275,7 +275,7 @@ class UserManager internal constructor(private val userRepository: UsersReposito
|
|||||||
user.externalSignalingServer = LoganSquare
|
user.externalSignalingServer = LoganSquare
|
||||||
.parse(userAttributes.externalSignalingServer, ExternalSignalingServer::class.java)
|
.parse(userAttributes.externalSignalingServer, ExternalSignalingServer::class.java)
|
||||||
}
|
}
|
||||||
user.current = true
|
user.current = userAttributes.currentUser == true
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author Mario Danic
|
* @author Mario Danic
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
Loading…
Reference in New Issue
Block a user