Extract condition to reduce code complexity
This commit is contained in:
parent
cbf9dbf290
commit
128ff0d6ec
|
@ -46,8 +46,7 @@ internal class DefaultSendEventTask @Inject constructor(
|
||||||
|
|
||||||
override suspend fun execute(params: SendEventTask.Params): String {
|
override suspend fun execute(params: SendEventTask.Params): String {
|
||||||
try {
|
try {
|
||||||
if (RoomLocalEcho.isLocalEchoId(params.event.roomId.orEmpty())) {
|
if (params.event.isLocalRoomEvent) {
|
||||||
// Room is local, so create a real one and send the event to this new room
|
|
||||||
return createRoomAndSendEvent(params)
|
return createRoomAndSendEvent(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,4 +104,7 @@ internal class DefaultSendEventTask @Inject constructor(
|
||||||
}
|
}
|
||||||
return params.event
|
return params.event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val Event.isLocalRoomEvent
|
||||||
|
get() = RoomLocalEcho.isLocalEchoId(roomId.orEmpty())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue