moving invitiation joined event filtering to the existing mapNotNull chain to avoid another list creation
This commit is contained in:
parent
0c809b5ed1
commit
37a7d449ae
|
@ -52,10 +52,11 @@ internal class DefaultProcessEventForPushTask @Inject constructor(
|
||||||
}
|
}
|
||||||
val newJoinEvents = params.syncResponse.join
|
val newJoinEvents = params.syncResponse.join
|
||||||
.mapNotNull { (key, value) ->
|
.mapNotNull { (key, value) ->
|
||||||
value.timeline?.events?.map { it.copy(roomId = key) }
|
value.timeline?.events?.mapNotNull {
|
||||||
|
it.takeIf { !it.isInvitation() }?.copy(roomId = key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.flatten()
|
.flatten()
|
||||||
.filterNot { it.isInvitationJoined() }
|
|
||||||
|
|
||||||
val inviteEvents = params.syncResponse.invite
|
val inviteEvents = params.syncResponse.invite
|
||||||
.mapNotNull { (key, value) ->
|
.mapNotNull { (key, value) ->
|
||||||
|
@ -101,5 +102,5 @@ internal class DefaultProcessEventForPushTask @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Event.isInvitationJoined(): Boolean = type == EventType.STATE_ROOM_MEMBER &&
|
private fun Event.isInvitation(): Boolean = type == EventType.STATE_ROOM_MEMBER &&
|
||||||
content?.toModel<RoomMemberContent>()?.membership == Membership.INVITE
|
content?.toModel<RoomMemberContent>()?.membership == Membership.INVITE
|
||||||
|
|
Loading…
Reference in New Issue