Implement MSC4155: Invite filtering (#29603)
* Add settings for MSC4155 * copyright * Tweak to not use js-sdk * Update for latest MSC * Various tidyups * Move tab * i18n * update .snap * mvvm * lint * add header * Remove capability check * fix * Rewrite to use Settings * lint * lint * fix test * Tweaks * lint * revert copyright * update screenshot * cleanup
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2025 New Vector Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export const INVITE_RULES_ACCOUNT_DATA_TYPE = "org.matrix.msc4155.invite_permission_config";
|
||||
|
||||
export interface InviteConfigAccountData {
|
||||
allowed_users?: string[];
|
||||
blocked_users?: string[];
|
||||
ignored_users?: string[];
|
||||
allowed_servers?: string[];
|
||||
blocked_servers?: string[];
|
||||
ignored_servers?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Computed values based on MSC4155. Currently Element Web only supports
|
||||
* blocking all invites.
|
||||
*/
|
||||
export interface ComputedInviteConfig extends Record<string, unknown> {
|
||||
/**
|
||||
* Are all invites blocked. This is only about blocking all invites,
|
||||
* but this being false may still block invites through other rules.
|
||||
*/
|
||||
allBlocked: boolean;
|
||||
}
|
||||
Vendored
+3
-1
@@ -15,6 +15,7 @@ import type { EmptyObject } from "matrix-js-sdk/src/matrix";
|
||||
import type { DeviceClientInformation } from "../utils/device/types.ts";
|
||||
import type { UserWidget } from "../utils/WidgetUtils-types.ts";
|
||||
import { type MediaPreviewConfig } from "./media_preview.ts";
|
||||
import { type INVITE_RULES_ACCOUNT_DATA_TYPE, type InviteConfigAccountData } from "./invite-rules.ts";
|
||||
|
||||
// Extend Matrix JS SDK types via Typescript declaration merging to support unspecced event fields and types
|
||||
declare module "matrix-js-sdk/src/types" {
|
||||
@@ -60,7 +61,6 @@ declare module "matrix-js-sdk/src/types" {
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface AccountDataEvents {
|
||||
// Analytics account data event
|
||||
"im.vector.analytics": {
|
||||
@@ -89,6 +89,8 @@ declare module "matrix-js-sdk/src/types" {
|
||||
accepted: string[];
|
||||
};
|
||||
|
||||
// MSC4155: Invite filtering
|
||||
[INVITE_RULES_ACCOUNT_DATA_TYPE]: InviteConfigAccountData;
|
||||
"io.element.msc4278.media_preview_config": MediaPreviewConfig;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user