fix: put reason of redaction in the redacted event

This commit is contained in:
Timo 2020-08-23 16:47:27 +02:00
parent 7ba9263cc6
commit 38663228f5
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
2 changed files with 6 additions and 20 deletions

View file

@ -35,7 +35,7 @@ pub struct PduEvent {
}
impl PduEvent {
pub fn redact(&mut self) -> Result<()> {
pub fn redact(&mut self, reason: &PduEvent) -> Result<()> {
self.unsigned.clear();
let allowed: &[&str] = match self.kind {
@ -71,7 +71,7 @@ impl PduEvent {
self.unsigned.insert(
"redacted_because".to_owned(),
json!({"content": {}, "type": "m.room.redaction"}),
serde_json::to_string(reason).expect("PduEvent::to_string always works").into()
);
self.content = new_content.into();