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

View file

@ -39,8 +39,7 @@ 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<*, *>
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