mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +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")
|
||||
abstract fun getUserWithUserId(userId: String): Maybe<UserEntity>
|
||||
|
||||
@Query("SELECT * FROM User where userId != :userId")
|
||||
abstract fun getUsersWithoutUserId(userId: Long): Single<List<UserEntity>>
|
||||
@Query("SELECT * FROM User where id != :id")
|
||||
abstract fun getUsersWithoutId(id: Long): Single<List<UserEntity>>
|
||||
|
||||
@Query("SELECT * FROM User where scheduledForDeletion = 1")
|
||||
abstract fun getUsersScheduledForDeletion(): Single<List<UserEntity>>
|
||||
|
@ -33,7 +33,7 @@ interface UsersRepository {
|
||||
fun getUserWithId(id: Long): Maybe<User>
|
||||
fun getUserWithIdNotScheduledForDeletion(id: Long): 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 getUsersNotScheduledForDeletion(): Single<List<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) }
|
||||
}
|
||||
|
||||
override fun getUsersWithoutUserId(userId: Long): Single<List<User>> {
|
||||
return usersDao.getUsersWithoutUserId(userId).map { UserMapper.toModel(it) }
|
||||
override fun getUsersWithoutUserId(id: Long): Single<List<User>> {
|
||||
return usersDao.getUsersWithoutId(id).map { UserMapper.toModel(it) }
|
||||
}
|
||||
|
||||
override fun getUsersScheduledForDeletion(): Single<List<User>> {
|
||||
|
@ -57,8 +57,8 @@ class UserManager internal constructor(private val userRepository: UsersReposito
|
||||
return userRepository.getUserWithId(id)
|
||||
}
|
||||
|
||||
fun disableAllUsersWithoutId(userId: Long): Single<Int> {
|
||||
val results = userRepository.getUsersWithoutUserId(userId)
|
||||
fun disableAllUsersWithoutId(id: Long): Single<Int> {
|
||||
val results = userRepository.getUsersWithoutUserId(id)
|
||||
|
||||
return results.map { users ->
|
||||
var count = 0
|
||||
@ -275,7 +275,7 @@ class UserManager internal constructor(private val userRepository: UsersReposito
|
||||
user.externalSignalingServer = LoganSquare
|
||||
.parse(userAttributes.externalSignalingServer, ExternalSignalingServer::class.java)
|
||||
}
|
||||
user.current = true
|
||||
user.current = userAttributes.currentUser == true
|
||||
return user
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @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>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
Loading…
Reference in New Issue
Block a user