-
Notifications
You must be signed in to change notification settings - Fork 60
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
Conversation
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.
lgtm
// 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); |
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.
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 /redact
fails. Trying to workaround by using !mjolnir redact
will no longer work in this room because Mjolnir will no longer receive unredacted events from /messages
due to the behavior of MSC4293.
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.
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 comment
The 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 /redact
again
Lines 102 to 121 in 41a0ca2
await getMessagesByUserIn(client, userIdOrGlob, targetRoomId, limit, async (eventsToRedact) => { | |
for (const targetEvent of eventsToRedact) { | |
await managementRoom.logMessage( | |
LogLevel.DEBUG, | |
"utils#redactUserMessagesIn", | |
`Redacting ${targetEvent["event_id"]} in ${targetRoomId}`, | |
targetRoomId, | |
); | |
if (!noop) { | |
await client.redactEvent(targetRoomId, targetEvent["event_id"]); | |
} else { | |
await managementRoom.logMessage( | |
LogLevel.WARN, | |
"utils#redactUserMessagesIn", | |
`Tried to redact ${targetEvent["event_id"]} in ${targetRoomId} but Mjolnir is running in no-op mode`, | |
targetRoomId, | |
); | |
} | |
} | |
}); |
// 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, |
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?
MSC: matrix-org/matrix-spec-proposals#4293