Message queuing : use redactEvent on timeline instead of room.

This commit is contained in:
ganfra 2024-06-06 15:23:28 +02:00
parent 41e5a6dd40
commit 7100a9d619
5 changed files with 14 additions and 28 deletions

View file

@ -304,11 +304,9 @@ class MessagesPresenter @AssistedInject constructor(
}
private suspend fun handleActionRedact(event: TimelineItem.Event) {
if (event.failedToSend) {
// If the message hasn't been sent yet, just cancel it
event.transactionId?.let { room.cancelSend(it) }
} else if (event.eventId != null) {
room.redactEvent(event.eventId)
timelineController.invokeOnCurrentTimeline {
redactEvent(eventId = event.eventId, transactionId = event.transactionId, reason = null)
.onFailure { Timber.e(it) }
}
}

View file

@ -68,8 +68,12 @@ class PollRepository @Inject constructor(
suspend fun deletePoll(
pollStartId: EventId,
): Result<Unit> =
room.redactEvent(
eventId = pollStartId,
)
): Result<Boolean> =
timelineProvider
.getActiveTimeline()
.redactEvent(
eventId = pollStartId,
transactionId = null,
reason = null,
)
}