Handle EventRedacted case. Fixes #5569

This commit is contained in:
Benoit Marty
2026-02-24 12:38:20 +01:00
parent 441e4ad3fa
commit b3b22033aa
3 changed files with 21 additions and 0 deletions

View File

@@ -22,6 +22,11 @@ sealed class NotificationResolverException : Exception() {
*/
data object EventFilteredOut : NotificationResolverException()
/**
* The event was found but it has been redacted.
*/
data object EventRedacted : NotificationResolverException()
/**
* An unexpected error occurred while trying to resolve the event.
*/

View File

@@ -66,6 +66,10 @@ class RustNotificationService(
Timber.d("Could not retrieve event for notification with $eventId - event filtered out")
put(eventId, Result.failure(NotificationResolverException.EventFilteredOut))
}
NotificationStatus.EventRedacted -> {
Timber.d("Could not retrieve event for notification with $eventId - event redacted")
put(eventId, Result.failure(NotificationResolverException.EventRedacted))
}
}
}
is BatchNotificationResult.Error -> {

View File

@@ -124,6 +124,14 @@ class DefaultPushHandler(
sessionId = request.sessionId,
comment = "Push handled successfully but notification was filtered out",
)
} else if (exception is NotificationResolverException.EventRedacted) {
pushHistoryService.onSuccess(
providerInfo = request.providerInfo,
eventId = request.eventId,
roomId = request.roomId,
sessionId = request.sessionId,
comment = "Push handled successfully but event has been redacted",
)
} else {
val reason = when (exception) {
is NotificationResolverException.EventNotFound -> "Event not found"
@@ -155,6 +163,10 @@ class DefaultPushHandler(
// Do nothing, we don't want to show a notification for filtered out events
null
}
is NotificationResolverException.EventRedacted -> {
// Do nothing, we don't want to show a notification for redacted events
null
}
else -> {
Timber.tag(loggerTag.value).e(exception, "Failed to resolve push event")
ResolvedPushEvent.Event(