Apply push rules on encrypted events

This commit is contained in:
Florian Renaud 2023-02-23 17:43:39 +01:00
parent ef38ba033f
commit b6ac915805
1 changed files with 2 additions and 3 deletions

View File

@ -39,9 +39,8 @@ class EventMatchCondition(
override fun technicalDescription() = "'$key' matches '$pattern'"
fun isSatisfied(event: Event): Boolean {
// TODO encrypted events?
val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *>
?: return false
val rawJson: Map<*, *> = event.mxDecryptionResult?.payload ?: MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *>
?: return false
val value = extractField(rawJson, key) ?: return false
// The match is performed case-insensitively, and must match the entire value of