drop redacted events from search results

This commit is contained in:
Benjamin Lee 2024-06-06 00:23:33 -07:00 committed by Charles Hall
parent f74043df9a
commit 83cdc9c708
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
2 changed files with 28 additions and 9 deletions

View file

@ -90,6 +90,24 @@ impl PduEvent {
Ok(())
}
pub(crate) fn is_redacted(&self) -> bool {
#[derive(Deserialize)]
struct ExtractRedactedBecause {
redacted_because: Option<serde::de::IgnoredAny>,
}
let Some(unsigned) = &self.unsigned else {
return false;
};
let Ok(unsigned) = ExtractRedactedBecause::deserialize(&**unsigned)
else {
return false;
};
unsigned.redacted_because.is_some()
}
pub(crate) fn remove_transaction_id(&mut self) -> crate::Result<()> {
if let Some(unsigned) = &self.unsigned {
let mut unsigned: BTreeMap<String, Box<RawJsonValue>> =