Skip to content

Commit 725ebb9

Browse files
committed
Redacted messages should have their HTML removed (#67)
1 parent ca39509 commit 725ebb9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/message/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl MessageEvent {
389389
}
390390
}
391391

392-
pub fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
392+
fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
393393
match self {
394394
MessageEvent::EncryptedOriginal(_) => return,
395395
MessageEvent::EncryptedRedacted(_) => return,
@@ -808,6 +808,11 @@ impl Message {
808808

809809
Span::styled(sender, style).into()
810810
}
811+
812+
pub fn redact(&mut self, redaction: SyncRoomRedactionEvent, version: &RoomVersionId) {
813+
self.event.redact(redaction, version);
814+
self.html = None;
815+
}
811816
}
812817

813818
impl From<RoomEncryptedEvent> for Message {

src/worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ impl ClientWorker {
774774
Some(EventLocation::Message(key)) => {
775775
if let Some(msg) = info.messages.get_mut(key) {
776776
let ev = SyncRoomRedactionEvent::Original(ev);
777-
msg.event.redact(ev, room_version);
777+
msg.redact(ev, room_version);
778778
}
779779
},
780780
Some(EventLocation::Reaction(event_id)) => {

0 commit comments

Comments
 (0)