Skip to content

Commit

Permalink
Improve createRoomThreePidEvents for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Renaud committed Aug 25, 2022
1 parent eab4ebc commit cac4df7
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ internal class DefaultCreateLocalRoomStateEventsTask @Inject constructor(
* Generate the local state events related to the given third party invites, if any.
*/
private fun MutableList<Event>.createRoomThreePidEvents() {
val threePidEvents = createRoomBody.invite3pids.orEmpty().map { body ->
createRoomBody.invite3pids.orEmpty().forEach { body ->
val localThirdPartyInviteEvent = createLocalStateEvent(
type = EventType.LOCAL_STATE_ROOM_THIRD_PARTY_INVITE,
content = LocalRoomThirdPartyInviteContent(
Expand All @@ -168,11 +168,16 @@ internal class DefaultCreateLocalRoomStateEventsTask @Inject constructor(
)
val thirdPartyInviteEvent = createLocalStateEvent(
type = EventType.STATE_ROOM_THIRD_PARTY_INVITE,
content = RoomThirdPartyInviteContent(body.address, null, null, null).toContent(),
content = RoomThirdPartyInviteContent(
displayName = body.address,
keyValidityUrl = null,
publicKey = null,
publicKeys = null
).toContent(),
)
listOf(localThirdPartyInviteEvent, thirdPartyInviteEvent)
}.flatten()
addAll(threePidEvents)
add(localThirdPartyInviteEvent)
add(thirdPartyInviteEvent)
}
}

/**
Expand Down

0 comments on commit cac4df7

Please sign in to comment.