mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-25 15:08:12 +08:00
use orEmpty()
This commit is contained in:
parent
2a3694d8b7
commit
5848ec21f7
@ -92,6 +92,6 @@ class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getUserIdsOfRoomMembers(): Set<String> {
|
fun getUserIdsOfRoomMembers(): Set<String> {
|
||||||
return room.roomSummary()?.otherMemberIds?.toSet() ?: emptySet()
|
return room.roomSummary()?.otherMemberIds?.toSet().orEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class RoomDirectoryViewModel @AssistedInject constructor(
|
|||||||
val joinedRoomIds = list
|
val joinedRoomIds = list
|
||||||
?.map { it.roomId }
|
?.map { it.roomId }
|
||||||
?.toSet()
|
?.toSet()
|
||||||
?: emptySet()
|
.orEmpty()
|
||||||
|
|
||||||
setState {
|
setState {
|
||||||
copy(joinedRoomsIds = joinedRoomIds)
|
copy(joinedRoomsIds = joinedRoomIds)
|
||||||
|
@ -119,7 +119,7 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User
|
|||||||
Single.just(emptyList<User>())
|
Single.just(emptyList<User>())
|
||||||
} else {
|
} else {
|
||||||
val searchObservable = session.rx()
|
val searchObservable = session.rx()
|
||||||
.searchUsersDirectory(search, 50, state.excludedUserIds ?: emptySet())
|
.searchUsersDirectory(search, 50, state.excludedUserIds.orEmpty())
|
||||||
.map { users ->
|
.map { users ->
|
||||||
users.sortedBy { it.toMatrixItem().firstLetterOfDisplayName() }
|
users.sortedBy { it.toMatrixItem().firstLetterOfDisplayName() }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user