mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
simplify call chain
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
443110557c
commit
84c1874284
1 changed files with 7 additions and 8 deletions
|
@ -45,14 +45,13 @@ class UserManager internal constructor(private val userRepository: UsersReposito
|
|||
val results = userRepository.getUsersNotScheduledForDeletion()
|
||||
|
||||
return results.map { users ->
|
||||
var result: User? = null
|
||||
if (users.isNotEmpty()) {
|
||||
val user = users[0]
|
||||
user.current = true
|
||||
userRepository.updateUser(user)
|
||||
result = user
|
||||
}
|
||||
result
|
||||
users
|
||||
.firstOrNull()
|
||||
?.apply {
|
||||
current = true
|
||||
}?.also { user ->
|
||||
userRepository.updateUser(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue