Add stable prefix for MSC2313 policy rules. (#7511)

https://github.com/matrix-org/mjolnir/issues/177
pull/21833/head
Gnuxie 2022-01-17 16:48:09 +00:00 committed by GitHub
parent 6b870ba1a9
commit 12e967a97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -19,13 +19,14 @@ limitations under the License.
import { ListRule, RECOMMENDATION_BAN, recommendationToStable } from "./ListRule"; import { ListRule, RECOMMENDATION_BAN, recommendationToStable } from "./ListRule";
import { MatrixClientPeg } from "../MatrixClientPeg"; import { MatrixClientPeg } from "../MatrixClientPeg";
export const RULE_USER = "m.room.rule.user"; export const RULE_USER = "m.policy.rule.user";
export const RULE_ROOM = "m.room.rule.room"; export const RULE_ROOM = "m.policy.rule.room";
export const RULE_SERVER = "m.room.rule.server"; export const RULE_SERVER = "m.policy.rule.server";
export const USER_RULE_TYPES = [RULE_USER, "org.matrix.mjolnir.rule.user"]; // m.room.* events are legacy from when MSC2313 changed to m.policy.* last minute.
export const ROOM_RULE_TYPES = [RULE_ROOM, "org.matrix.mjolnir.rule.room"]; export const USER_RULE_TYPES = [RULE_USER, "m.room.rule.user", "org.matrix.mjolnir.rule.user"];
export const SERVER_RULE_TYPES = [RULE_SERVER, "org.matrix.mjolnir.rule.server"]; export const ROOM_RULE_TYPES = [RULE_ROOM, "m.room.rule.room", "org.matrix.mjolnir.rule.room"];
export const SERVER_RULE_TYPES = [RULE_SERVER, "m.room.rule.server", "org.matrix.mjolnir.rule.server"];
export const ALL_RULE_TYPES = [...USER_RULE_TYPES, ...ROOM_RULE_TYPES, ...SERVER_RULE_TYPES]; export const ALL_RULE_TYPES = [...USER_RULE_TYPES, ...ROOM_RULE_TYPES, ...SERVER_RULE_TYPES];
export function ruleTypeToStable(rule: string, unstable = true): string { export function ruleTypeToStable(rule: string, unstable = true): string {