mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Should fix issue with DM creation where we can ends up with DM in rooms
This commit is contained in:
parent
d520dfe108
commit
1b8b59076c
1 changed files with 3 additions and 1 deletions
|
@ -31,9 +31,11 @@ internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
||||||
*/
|
*/
|
||||||
fun getLocalUserAccount(filterRoomId: String? = null): MutableMap<String, MutableList<String>> {
|
fun getLocalUserAccount(filterRoomId: String? = null): MutableMap<String, MutableList<String>> {
|
||||||
return Realm.getInstance(realmConfiguration).use { realm ->
|
return Realm.getInstance(realmConfiguration).use { realm ->
|
||||||
|
// Makes sure we have the latest realm updates, this is important as we sent this information to the server.
|
||||||
|
realm.refresh()
|
||||||
RoomSummaryEntity.getDirectRooms(realm)
|
RoomSummaryEntity.getDirectRooms(realm)
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.filter { it.roomId != filterRoomId && it.directUserId != null }
|
.filter { it.roomId != filterRoomId && it.directUserId != null && it.membership.isActive() }
|
||||||
.groupByTo(mutableMapOf(), { it.directUserId!! }, { it.roomId })
|
.groupByTo(mutableMapOf(), { it.directUserId!! }, { it.roomId })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue