Improve getClearContent() method: it should not fallback to the encrypted content when the content is not decrypted.

This commit is contained in:
Benoit Marty 2024-02-01 17:28:29 +01:00
parent cc355a8e14
commit a1140fd8fa
1 changed files with 8 additions and 2 deletions

View File

@ -219,10 +219,16 @@ data class Event(
}
/**
* @return the event content
* @return the event content.
* If the content is encrypted, it will return the decrypted content, or null if the content is not
* decrypted.
*/
fun getClearContent(): Content? {
return getDecryptedContent() ?: content
return if (isEncrypted()) {
getDecryptedContent()
} else {
content
}
}
/**