-
Notifications
You must be signed in to change notification settings - Fork 61
Set MSC4293 flag when autoredacting users #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -481,14 +481,23 @@ export class ProtectedRoomsSet { | |||||||||||||||||||||||||||||||||||||||||
await this.managementRoomOutput.logMessage( | ||||||||||||||||||||||||||||||||||||||||||
LogLevel.WARN, | ||||||||||||||||||||||||||||||||||||||||||
"ApplyBan", | ||||||||||||||||||||||||||||||||||||||||||
`Attempted | ||||||||||||||||||||||||||||||||||||||||||
to ban ${member.userId} but this is a member of the management room, skipping.`, | ||||||||||||||||||||||||||||||||||||||||||
`Attempted to ban ${member.userId} but this is a member of the management room, skipping.`, | ||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||
continue; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
await this.client.banUser(member.userId, roomId, memberAccess.rule!.reason); | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if (this.automaticRedactGlobs.find((g) => g.test(reason.toLowerCase()))) { | ||||||||||||||||||||||||||||||||||||||||||
// Use MSC4293 and still fall back later | ||||||||||||||||||||||||||||||||||||||||||
// See https://github.com/matrix-org/matrix-spec-proposals/pull/4293 | ||||||||||||||||||||||||||||||||||||||||||
await this.client.sendStateEvent(roomId, "m.room.member", member.userId, { | ||||||||||||||||||||||||||||||||||||||||||
"membership": "ban", | ||||||||||||||||||||||||||||||||||||||||||
"org.matrix.msc4293.redact_events": true, | ||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
// Fallback | ||||||||||||||||||||||||||||||||||||||||||
this.redactUser(member.userId, roomId); | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+490
to
498
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a risk here if Mjolnir fails to redact events in the fallback. This can happen if there are more events in the timeline than the pagination limit, or if a call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Receiving redacted events might be fine though? The logic could probably inspect the reason if it wanted too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true, It could be fine, but only because mjolnir doesn't exclude the redacted events from being called with Lines 102 to 121 in 41a0ca2
|
||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||
await this.client.banUser(member.userId, roomId, memberAccess.rule!.reason); | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||
await this.managementRoomOutput.logMessage( | ||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was
reason
intentionally omitted here?