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,
roomId = params.roomId,
eventId = params.eventId,
body = EventRedactBody(params.reason, withRelations, withRelations)
body = EventRedactBody(
reason = params.reason,
withRelations = withRelations,
withRelationsUnstable = withRelations,
)
)
}
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 {
val localId = LocalEcho.createLocalEchoId()
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 {
additionalContent
}

View file

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