mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-07-18 17:46:15 +00:00
Update Draupnir for reworked hash reversal.
We introduced a new PolicyRuleChangeType enum with a variant for revealed literals. And we changed our mind about where reversal will happen, it'll happen in the room state manager factory.
This commit is contained in:
@@ -163,7 +163,8 @@ export class DraupnirBotModeToggle implements BotModeTogle {
|
||||
clientsInRoomMap,
|
||||
clientProvider,
|
||||
DefaultEventDecoder,
|
||||
stores.roomStateBackingStore
|
||||
stores.roomStateBackingStore,
|
||||
stores.hashStore
|
||||
);
|
||||
const draupnirFactory = new DraupnirFactory(
|
||||
clientsInRoomMap,
|
||||
|
||||
@@ -128,7 +128,8 @@ export class MjolnirAppService {
|
||||
clientsInRoomMap,
|
||||
clientProvider,
|
||||
eventDecoder,
|
||||
stores.roomStateBackingStore
|
||||
stores.roomStateBackingStore,
|
||||
stores.hashStore
|
||||
);
|
||||
const clientCapabilityFactory = new ClientCapabilityFactory(
|
||||
clientsInRoomMap,
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
PolicyListRevision,
|
||||
PolicyRule,
|
||||
PolicyRuleChange,
|
||||
PolicyRuleChangeType,
|
||||
PolicyRuleMatchType,
|
||||
PolicyRuleType,
|
||||
PowerLevelPermission,
|
||||
@@ -25,7 +26,6 @@ import {
|
||||
ProtectionDescription,
|
||||
Recommendation,
|
||||
RoomMembershipRevision,
|
||||
SimpleChangeType,
|
||||
Task,
|
||||
describeProtection,
|
||||
} from "matrix-protection-suite";
|
||||
@@ -93,7 +93,7 @@ export class RedactionSynchronisationProtection
|
||||
): Promise<ActionResult<void>> {
|
||||
const relevantChanges = changes.filter(
|
||||
(change) =>
|
||||
change.changeType === SimpleChangeType.Added &&
|
||||
change.changeType !== PolicyRuleChangeType.Removed &&
|
||||
change.rule.kind === PolicyRuleType.User &&
|
||||
this.automaticRedactionReasons.some((reason) =>
|
||||
reason.test(change.rule.reason ?? "<no reason supplied>")
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Logger,
|
||||
RoomBasicDetails,
|
||||
RoomHashRecord,
|
||||
SHA256RoomHashStore,
|
||||
SHA256HashStore,
|
||||
StandardBatcher,
|
||||
Task,
|
||||
} from "matrix-protection-suite";
|
||||
@@ -47,7 +47,7 @@ export class SynapseHTTPAntispamRoomDiscovery
|
||||
);
|
||||
constructor(
|
||||
private readonly synapseHTTPAntispam: SynapseHttpAntispam,
|
||||
private readonly hashStore: SHA256RoomHashStore,
|
||||
private readonly hashStore: SHA256HashStore,
|
||||
private readonly roomDetailsProvider: RoomDetailsProvider
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
Logger,
|
||||
PolicyListRevision,
|
||||
PolicyRuleChange,
|
||||
PolicyRuleChangeType,
|
||||
PolicyRuleMatchType,
|
||||
PolicyRuleType,
|
||||
Recommendation,
|
||||
SimpleChangeType,
|
||||
} from "matrix-protection-suite";
|
||||
import { RoomAuditLog } from "./RoomAuditLog";
|
||||
import { isError, Ok, Result, ResultError } from "@gnuxie/typescript-result";
|
||||
@@ -93,7 +93,7 @@ export class StandardRoomTakedown implements RoomTakedownService {
|
||||
const roomsToTakedown: LiteralPolicyRule[] = [];
|
||||
for (const change of changes) {
|
||||
if (
|
||||
change.changeType === SimpleChangeType.Added &&
|
||||
change.changeType === PolicyRuleChangeType.RevealedLiteral &&
|
||||
change.rule.kind === PolicyRuleType.Room &&
|
||||
change.rule.matchType === PolicyRuleMatchType.Literal &&
|
||||
change.rule.recommendation === Recommendation.Takedown
|
||||
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
describeProtectedRoomsSet,
|
||||
Ok,
|
||||
parsePolicyRule,
|
||||
PolicyRuleChangeType,
|
||||
PolicyRuleType,
|
||||
randomRoomID,
|
||||
Recommendation,
|
||||
SimpleChangeType,
|
||||
StandardPolicyListRevision,
|
||||
} from "matrix-protection-suite";
|
||||
import { RoomAuditLog } from "../../../src/protections/RoomTakedown/RoomAuditLog";
|
||||
@@ -81,7 +81,7 @@ describe("", function () {
|
||||
StandardPolicyListRevision.blankRevision(),
|
||||
[
|
||||
{
|
||||
changeType: SimpleChangeType.Added,
|
||||
changeType: PolicyRuleChangeType.Added,
|
||||
rule: policy,
|
||||
event: policy.sourceEvent,
|
||||
sender: policy.sourceEvent.sender,
|
||||
|
||||
Reference in New Issue
Block a user