Skip to content

Commit 41a0ca2

Browse files
authored
Set MSC4293 flag when autoredacting users (#612)
1 parent 6deb04f commit 41a0ca2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/ProtectedRoomsSet.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,23 @@ export class ProtectedRoomsSet {
481481
await this.managementRoomOutput.logMessage(
482482
LogLevel.WARN,
483483
"ApplyBan",
484-
`Attempted
485-
to ban ${member.userId} but this is a member of the management room, skipping.`,
484+
`Attempted to ban ${member.userId} but this is a member of the management room, skipping.`,
486485
);
487486
continue;
488487
}
489-
await this.client.banUser(member.userId, roomId, memberAccess.rule!.reason);
488+
490489
if (this.automaticRedactGlobs.find((g) => g.test(reason.toLowerCase()))) {
490+
// Use MSC4293 and still fall back later
491+
// See https://github.com/matrix-org/matrix-spec-proposals/pull/4293
492+
await this.client.sendStateEvent(roomId, "m.room.member", member.userId, {
493+
"membership": "ban",
494+
"org.matrix.msc4293.redact_events": true,
495+
});
496+
497+
// Fallback
491498
this.redactUser(member.userId, roomId);
499+
} else {
500+
await this.client.banUser(member.userId, roomId, memberAccess.rule!.reason);
492501
}
493502
} else {
494503
await this.managementRoomOutput.logMessage(

0 commit comments

Comments
 (0)