Redacted messages should have their HTML removed (#67)

This commit is contained in:
Ulyssa 2023-03-22 21:25:37 -07:00
parent ca395097e1
commit 725ebb9fd6
No known key found for this signature in database
GPG key ID: 1B3965A3D18B9B64
2 changed files with 7 additions and 2 deletions

View file

@ -389,7 +389,7 @@ impl MessageEvent {
}
}
pub fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
match self {
MessageEvent::EncryptedOriginal(_) => return,
MessageEvent::EncryptedRedacted(_) => return,
@ -808,6 +808,11 @@ impl Message {
Span::styled(sender, style).into()
}
pub fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
self.event.redact(redaction, version);
self.html = None;
}
}
impl From<RoomEncryptedEvent> for Message {

View file

@ -774,7 +774,7 @@ impl ClientWorker {
Some(EventLocation::Message(key)) => {
if let Some(msg) = info.messages.get_mut(key) {
let ev = SyncRoomRedactionEvent::Original(ev);
msg.event.redact(ev, room_version);
msg.redact(ev, room_version);
}
},
Some(EventLocation::Reaction(event_id)) => {