Commit 87601f4b82

87601f4b82a52920088b7d62805617087cedea97

parent: 44ab83f5c4

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-07-21 23:21 UTC
committer: <strk@kbt.io>

fix: run redactions on the Matrix runtime

Layout: unified · split

src/commands/redact.rs +1 −12
@@ -91,19 +91,8 @@ impl RedactCommand {
9191 reason: Option<String>,
9292 ) {
9393 if let Some(room) = self.servers.find_room(buffer) {
94 let room = room.room().clone();
95
9694 Weechat::spawn(async move {
97 if let Err(error) =
98 room.redact(&event_id, reason.as_deref(), None).await
99 {
100 Weechat::print(&format!(
101 "{}Failed to redact {}: {}",
102 Weechat::prefix(Prefix::Error),
103 event_id,
104 error
105 ));
106 }
95 room.send_redaction(event_id, reason).await
10796 })
10897 .detach();
10998 } else {
src/room/mod.rs +27
@@ -1026,6 +1026,33 @@ impl MatrixRoom {
10261026 }
10271027 }
10281028
1029 pub async fn send_redaction(
1030 &self,
1031 event_id: OwnedEventId,
1032 reason: Option<String>,
1033 ) {
1034 let Some(connection) = self.connection.borrow().clone() else {
1035 self.print_error("Not connected. Please connect first.");
1036 return;
1037 };
1038
1039 let room = self.room().clone();
1040 let error_event_id = event_id.clone();
1041
1042 match connection
1043 .spawn(async move {
1044 room.redact(&event_id, reason.as_deref(), None).await
1045 })
1046 .await
1047 {
1048 Ok(_) => (),
1049 Err(error) => self.print_error(&format!(
1050 "Failed to redact {}: {}",
1051 error_event_id, error
1052 )),
1053 }
1054 }
1055
10291056 pub async fn send_attachment(&self, path: PathBuf) {
10301057 let Some(filename) = path
10311058 .file_name()