Merge pull request #7350 from hayaksi1/fix/5766-redaction-unknown-target

Do not notify about a redaction whose target event is unknown
This commit is contained in:
Benoit Marty
2026-08-11 16:21:28 +02:00
committed by GitHub
2 changed files with 4 additions and 3 deletions
@@ -304,8 +304,8 @@ class DefaultNotifiableEventResolver(
// Note: this case will be handled below
val redactedEventId = content.redactedEventId
if (redactedEventId == null) {
Timber.tag(loggerTag.value).d("redactedEventId is null.")
throw NotificationResolverException.UnknownError("redactedEventId is null")
Timber.tag(loggerTag.value).w("Ignoring redaction notification with no redactedEventId.")
throw NotificationResolverException.EventFilteredOut
} else {
ResolvedPushEvent.Redaction(
sessionId = userId,
@@ -822,7 +822,7 @@ class DefaultNotifiableEventResolverTest : RobolectricTest() {
}
@Test
fun `resolve RoomRedaction with null redactedEventId should return null`() = runTest {
fun `resolve RoomRedaction with null redactedEventId is filtered out`() = runTest {
val sut = createDefaultNotifiableEventResolver(
notificationResult = Result.success(
mapOf(
@@ -838,6 +838,7 @@ class DefaultNotifiableEventResolverTest : RobolectricTest() {
val request = aPushRequest(A_SESSION_ID, A_ROOM_ID, AN_EVENT_ID, "firebase")
val result = sut.resolveEvents(A_SESSION_ID, listOf(request))
assertThat(result.getEvent(request)?.getOrNull()).isNull()
assertThat(result.getEvent(request)?.exceptionOrNull()).isEqualTo(NotificationResolverException.EventFilteredOut)
}
@Test