findAll() does not return null value
This commit is contained in:
parent
9aadbbc3c7
commit
34c5f37bbc
|
@ -110,9 +110,11 @@ internal class ShieldTrustUpdater @Inject constructor(
|
||||||
|
|
||||||
val map = HashMap<String, List<String>>()
|
val map = HashMap<String, List<String>>()
|
||||||
impactedRoomsId.forEach { roomId ->
|
impactedRoomsId.forEach { roomId ->
|
||||||
RoomMemberSummaryEntity.where(backgroundSessionRealm.get(), roomId).findAll()?.let { results ->
|
RoomMemberSummaryEntity.where(backgroundSessionRealm.get(), roomId)
|
||||||
map[roomId] = results.map { it.userId }
|
.findAll()
|
||||||
}
|
.let { results ->
|
||||||
|
map[roomId] = results.map { it.userId }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map.forEach { entry ->
|
map.forEach { entry ->
|
||||||
|
|
|
@ -54,13 +54,11 @@ internal class DefaultRoomGetter @Inject constructor(
|
||||||
Realm.getInstance(monarchy.realmConfiguration).use { realm ->
|
Realm.getInstance(monarchy.realmConfiguration).use { realm ->
|
||||||
val candidates = RoomSummaryEntity.where(realm)
|
val candidates = RoomSummaryEntity.where(realm)
|
||||||
.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
||||||
.findAll()?.filter { dm ->
|
.findAll()
|
||||||
|
.filter { dm ->
|
||||||
dm.otherMemberIds.contains(otherUserId)
|
dm.otherMemberIds.contains(otherUserId)
|
||||||
&& dm.membership == Membership.JOIN
|
&& dm.membership == Membership.JOIN
|
||||||
}?.map {
|
}.map { it.roomId }
|
||||||
it.roomId
|
|
||||||
}
|
|
||||||
?: return null
|
|
||||||
candidates.forEach { roomId ->
|
candidates.forEach { roomId ->
|
||||||
if (RoomMemberHelper(realm, roomId).getActiveRoomMemberIds().any { it == otherUserId }) {
|
if (RoomMemberHelper(realm, roomId).getActiveRoomMemberIds().any { it == otherUserId }) {
|
||||||
return RoomEntity.where(realm, roomId).findFirst()?.let { roomFactory.create(roomId) }
|
return RoomEntity.where(realm, roomId).findFirst()?.let { roomFactory.create(roomId) }
|
||||||
|
|
Loading…
Reference in New Issue