From 92a73b4023cd12483d3856512b2dbbb391b16133 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Thu, 27 Mar 2025 14:16:08 +0000 Subject: [PATCH] Add new account data for MSC4155 --- src/@types/event.ts | 3 +++ src/@types/inviteconfig.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/@types/inviteconfig.ts diff --git a/src/@types/event.ts b/src/@types/event.ts index 479f7aef812..d50ace9756a 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -58,6 +58,7 @@ import { type LocalNotificationSettings } from "./local_notifications.ts"; import { type IPushRules } from "./PushRules.ts"; import { type SecretInfo, type SecretStorageKeyDescription } from "../secret-storage.ts"; import { type POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.ts"; +import { type InviteConfigAccountData } from "./inviteconfig.ts"; export enum EventType { // Room state events @@ -386,6 +387,8 @@ export interface AccountDataEvents extends SecretStorageAccountDataEvents { // Invites-ignorer events [POLICIES_ACCOUNT_EVENT_TYPE.name]: { [key: string]: any }; [POLICIES_ACCOUNT_EVENT_TYPE.altName]: { [key: string]: any }; + // MSC4155: Invite filtering + "org.matrix.msc4155.invite_permission_config": InviteConfigAccountData; } /** diff --git a/src/@types/inviteconfig.ts b/src/@types/inviteconfig.ts new file mode 100644 index 00000000000..c75fbcc24d8 --- /dev/null +++ b/src/@types/inviteconfig.ts @@ -0,0 +1,16 @@ +type Rule = "allow" | "block"; + +export interface InviteConfigAccountData { + /** + * Rule exceptions for users. Takes priority over `default` and `server_exceptions`. + */ + user_exceptions: Record; + /** + * Rule exceptions for users. Takes priority over `default`. + */ + server_exceptions: Record; + /** + * The default rule for invite handling when no exceptions match. + */ + default: Rule; +}