Unrestrict users automatically on policy changes too.

This commit is contained in:
gnuxie committed 2025-04-13 20:06:36 +01:00
1 parent ba87ed2ed4
commit af50fe22cd
1 file changed
+15 -1
@@ -94,8 +94,22 @@ export class HomeserverUserPolicyApplication {
(async () => {
for (const change of changes) {
if (change.changeType === PolicyRuleChangeType.Removed) {
if (
change.rule.matchType === PolicyRuleMatchType.Literal &&
isStringUserID(change.rule.entity)
) {
const unrestrictResult = await this.consequences.unrestrictUser(
change.rule.entity,
change.event.sender
);
if (isError(unrestrictResult)) {
log.error(
`Failed to unrestrict the user ${change.rule.entity}`,
unrestrictResult.error
);
}
}
continue;
// FIXME: Don't we want to unsuspend here?
// FIXME: What about modifying from a automaticallyRedactReason to a non redact reason?
}
const policy = change.rule;