Use named arguments for clarity

This commit is contained in:
Florian Renaud 2023-01-24 15:47:36 +01:00
parent b090cb6b4b
commit 52d0b826f4
3 changed files with 18 additions and 6 deletions

View File

@ -52,7 +52,11 @@ internal class DefaultRedactEventTask @Inject constructor(
txId = params.txID, txId = params.txID,
roomId = params.roomId, roomId = params.roomId,
eventId = params.eventId, eventId = params.eventId,
body = EventRedactBody(params.reason, withRelations, withRelations) body = EventRedactBody(
reason = params.reason,
withRelations = withRelations,
withRelationsUnstable = withRelations,
)
) )
} }
return response.eventId return response.eventId

View File

@ -799,7 +799,11 @@ internal class LocalEchoEventFactory @Inject constructor(
fun createRedactEvent(roomId: String, eventId: String, reason: String?, withRelations: List<String>? = null, additionalContent: Content? = null): Event { fun createRedactEvent(roomId: String, eventId: String, reason: String?, withRelations: List<String>? = null, additionalContent: Content? = null): Event {
val localId = LocalEcho.createLocalEchoId() val localId = LocalEcho.createLocalEchoId()
val content = if (reason != null || withRelations != null) { val content = if (reason != null || withRelations != null) {
EventRedactBody(reason, withRelations, withRelations).toContent().plus(additionalContent.orEmpty()) EventRedactBody(
reason = reason,
withRelations = withRelations,
withRelationsUnstable = withRelations,
).toContent().plus(additionalContent.orEmpty())
} else { } else {
additionalContent additionalContent
} }

View File

@ -69,10 +69,14 @@ internal class RedactEventWorker(context: Context, params: WorkerParameters, ses
return runCatching { return runCatching {
executeRequest(globalErrorReceiver) { executeRequest(globalErrorReceiver) {
roomAPI.redactEvent( roomAPI.redactEvent(
params.txID, txId = params.txID,
params.roomId, roomId = params.roomId,
eventId, eventId = eventId,
EventRedactBody(params.reason, withRelations, withRelations) body = EventRedactBody(
reason = params.reason,
withRelations = withRelations,
withRelationsUnstable = withRelations,
)
) )
} }
}.fold( }.fold(