mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/
mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts
And a couple of gitignore tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import {
|
||||
type MatrixClient,
|
||||
Room,
|
||||
PendingEventOrdering,
|
||||
MatrixEvent,
|
||||
Direction,
|
||||
EventType,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { type Member } from "../utils/direct-messages";
|
||||
|
||||
export const LOCAL_ROOM_ID_PREFIX = "local+";
|
||||
|
||||
export enum LocalRoomState {
|
||||
NEW, // new local room; only known to the client
|
||||
CREATING, // real room is being created
|
||||
CREATED, // real room has been created via API; events applied
|
||||
ERROR, // error during room creation
|
||||
}
|
||||
|
||||
/**
|
||||
* A local room that only exists client side.
|
||||
* Its main purpose is to be used for temporary rooms when creating a DM.
|
||||
*/
|
||||
export class LocalRoom extends Room {
|
||||
/** Whether the actual room should be encrypted. */
|
||||
public encrypted = false;
|
||||
/** If the actual room has been created, this holds its ID. */
|
||||
public actualRoomId?: string;
|
||||
/** DM chat partner */
|
||||
public targets: Member[] = [];
|
||||
/** Callbacks that should be invoked after the actual room has been created. */
|
||||
public afterCreateCallbacks: ((roomId: string) => void)[] = [];
|
||||
public state: LocalRoomState = LocalRoomState.NEW;
|
||||
|
||||
public constructor(roomId: string, client: MatrixClient, myUserId: string) {
|
||||
super(roomId, client, myUserId, { pendingEventOrdering: PendingEventOrdering.Detached });
|
||||
this.name = this.getDefaultRoomName(myUserId);
|
||||
}
|
||||
|
||||
public get isNew(): boolean {
|
||||
return this.state === LocalRoomState.NEW;
|
||||
}
|
||||
|
||||
public get isCreated(): boolean {
|
||||
return this.state === LocalRoomState.CREATED;
|
||||
}
|
||||
|
||||
public get isError(): boolean {
|
||||
return this.state === LocalRoomState.ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if encryption is enabled in this room.
|
||||
* True if the room has any encryption state event
|
||||
*/
|
||||
public isEncryptionEnabled(): boolean {
|
||||
const roomState = this.getLiveTimeline().getState(Direction.Forward);
|
||||
if (!roomState) return false;
|
||||
|
||||
const stateEvents = roomState.getStateEvents(EventType.RoomEncryption);
|
||||
if (stateEvents.length === 0) return false;
|
||||
|
||||
// if there is an encryption state event, it is encrypted.
|
||||
// Regardless of the content/algorithm, we assume it is encrypted.
|
||||
return stateEvents[0] instanceof MatrixEvent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { type IEventRelation, type UploadProgress } from "matrix-js-sdk/src/matrix";
|
||||
import { type EncryptedFile } from "matrix-js-sdk/src/types";
|
||||
|
||||
export class RoomUpload {
|
||||
public readonly abortController = new AbortController();
|
||||
public promise?: Promise<{ url?: string; file?: EncryptedFile }>;
|
||||
private uploaded = 0;
|
||||
|
||||
public constructor(
|
||||
public readonly roomId: string,
|
||||
public readonly fileName: string,
|
||||
public readonly relation?: IEventRelation,
|
||||
public fileSize = 0,
|
||||
) {}
|
||||
|
||||
public onProgress(progress: UploadProgress): void {
|
||||
this.uploaded = progress.loaded;
|
||||
this.fileSize = progress.total;
|
||||
}
|
||||
|
||||
public abort(): void {
|
||||
this.abortController.abort();
|
||||
}
|
||||
|
||||
public get cancelled(): boolean {
|
||||
return this.abortController.signal.aborted;
|
||||
}
|
||||
|
||||
public get total(): number {
|
||||
return this.fileSize;
|
||||
}
|
||||
|
||||
public get loaded(): number {
|
||||
return this.uploaded;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { RoomNotifState } from "../../RoomNotifs";
|
||||
|
||||
export type RoomDefaultNotificationLevel = RoomNotifState.AllMessages | RoomNotifState.MentionsOnly;
|
||||
|
||||
export type NotificationSettings = {
|
||||
globalMute: boolean;
|
||||
defaultLevels: {
|
||||
room: RoomDefaultNotificationLevel;
|
||||
dm: RoomDefaultNotificationLevel;
|
||||
};
|
||||
sound: {
|
||||
people: string | undefined;
|
||||
mentions: string | undefined;
|
||||
calls: string | undefined;
|
||||
};
|
||||
activity: {
|
||||
invite: boolean;
|
||||
status_event: boolean;
|
||||
bot_notices: boolean;
|
||||
};
|
||||
mentions: {
|
||||
user: boolean;
|
||||
keywords: boolean;
|
||||
room: boolean;
|
||||
};
|
||||
keywords: string[];
|
||||
};
|
||||
|
||||
export const DefaultNotificationSettings: NotificationSettings = {
|
||||
globalMute: false,
|
||||
defaultLevels: {
|
||||
room: RoomNotifState.AllMessages,
|
||||
dm: RoomNotifState.AllMessages,
|
||||
},
|
||||
sound: {
|
||||
people: "default",
|
||||
mentions: "default",
|
||||
calls: "ring",
|
||||
},
|
||||
activity: {
|
||||
invite: true,
|
||||
status_event: false,
|
||||
bot_notices: true,
|
||||
},
|
||||
mentions: {
|
||||
user: true,
|
||||
room: true,
|
||||
keywords: true,
|
||||
},
|
||||
keywords: [],
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { type IAnnotatedPushRule, type PushRuleAction, type PushRuleKind, type RuleId } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
export type PushRuleDiff = {
|
||||
updated: PushRuleUpdate[];
|
||||
added: IAnnotatedPushRule[];
|
||||
deleted: PushRuleDeletion[];
|
||||
};
|
||||
|
||||
export type PushRuleDeletion = {
|
||||
rule_id: RuleId | string;
|
||||
kind: PushRuleKind;
|
||||
};
|
||||
|
||||
export type PushRuleUpdate = {
|
||||
rule_id: RuleId | string;
|
||||
kind: PushRuleKind;
|
||||
enabled?: boolean;
|
||||
actions?: PushRuleAction[];
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { type IAnnotatedPushRule, type IPushRules, PushRuleKind, type RuleId } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
export type PushRuleMap = Map<RuleId | string, IAnnotatedPushRule>;
|
||||
|
||||
export function buildPushRuleMap(rulesets: IPushRules): PushRuleMap {
|
||||
const rules = new Map<RuleId | string, IAnnotatedPushRule>();
|
||||
|
||||
for (const kind of Object.values(PushRuleKind)) {
|
||||
for (const rule of rulesets.global[kind] ?? []) {
|
||||
if (rule.rule_id.startsWith(".")) {
|
||||
rules.set(rule.rule_id, { ...rule, kind });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { type IPushRules, PushRuleKind, RuleId } from "matrix-js-sdk/src/matrix";
|
||||
import { deepCompare } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { NotificationUtils } from "../../notifications";
|
||||
import { StandardActions } from "../../notifications/StandardActions";
|
||||
import { RoomNotifState } from "../../RoomNotifs";
|
||||
import { type NotificationSettings } from "./NotificationSettings";
|
||||
import { type PushRuleDiff, type PushRuleUpdate } from "./PushRuleDiff";
|
||||
import { buildPushRuleMap } from "./PushRuleMap";
|
||||
|
||||
function toStandardRules(
|
||||
model: NotificationSettings,
|
||||
supportsIntentionalMentions: boolean,
|
||||
): Map<RuleId | string, PushRuleUpdate> {
|
||||
const standardRules = new Map<RuleId | string, PushRuleUpdate>();
|
||||
|
||||
standardRules.set(RuleId.Master, {
|
||||
rule_id: RuleId.Master,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: model.globalMute,
|
||||
});
|
||||
|
||||
standardRules.set(RuleId.EncryptedMessage, {
|
||||
rule_id: RuleId.EncryptedMessage,
|
||||
kind: PushRuleKind.Underride,
|
||||
enabled: true,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: model.defaultLevels.room === RoomNotifState.AllMessages,
|
||||
highlight: false,
|
||||
}),
|
||||
});
|
||||
standardRules.set(RuleId.Message, {
|
||||
rule_id: RuleId.Message,
|
||||
kind: PushRuleKind.Underride,
|
||||
enabled: true,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: model.defaultLevels.room === RoomNotifState.AllMessages,
|
||||
highlight: false,
|
||||
}),
|
||||
});
|
||||
standardRules.set(RuleId.EncryptedDM, {
|
||||
rule_id: RuleId.EncryptedDM,
|
||||
kind: PushRuleKind.Underride,
|
||||
enabled: true,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: model.defaultLevels.dm === RoomNotifState.AllMessages,
|
||||
highlight: false,
|
||||
sound: model.sound.people,
|
||||
}),
|
||||
});
|
||||
standardRules.set(RuleId.DM, {
|
||||
rule_id: RuleId.DM,
|
||||
kind: PushRuleKind.Underride,
|
||||
enabled: true,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: model.defaultLevels.dm === RoomNotifState.AllMessages,
|
||||
highlight: false,
|
||||
sound: model.sound.people,
|
||||
}),
|
||||
});
|
||||
|
||||
standardRules.set(RuleId.SuppressNotices, {
|
||||
rule_id: RuleId.SuppressNotices,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: !model.activity.bot_notices,
|
||||
actions: StandardActions.ACTION_DONT_NOTIFY,
|
||||
});
|
||||
standardRules.set(RuleId.InviteToSelf, {
|
||||
rule_id: RuleId.InviteToSelf,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: model.activity.invite,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: true,
|
||||
highlight: false,
|
||||
sound: model.sound.people,
|
||||
}),
|
||||
});
|
||||
standardRules.set(RuleId.MemberEvent, {
|
||||
rule_id: RuleId.MemberEvent,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: true,
|
||||
actions: model.activity.status_event ? StandardActions.ACTION_NOTIFY : StandardActions.ACTION_DONT_NOTIFY,
|
||||
});
|
||||
|
||||
const mentionActions = NotificationUtils.encodeActions({
|
||||
notify: true,
|
||||
sound: model.sound.mentions,
|
||||
highlight: true,
|
||||
});
|
||||
const userMentionActions = model.mentions.user ? mentionActions : StandardActions.ACTION_DONT_NOTIFY;
|
||||
if (supportsIntentionalMentions) {
|
||||
standardRules.set(RuleId.IsUserMention, {
|
||||
rule_id: RuleId.IsUserMention,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: true,
|
||||
actions: userMentionActions,
|
||||
});
|
||||
}
|
||||
standardRules.set(RuleId.ContainsDisplayName, {
|
||||
rule_id: RuleId.ContainsDisplayName,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: true,
|
||||
actions: userMentionActions,
|
||||
});
|
||||
standardRules.set(RuleId.ContainsUserName, {
|
||||
rule_id: RuleId.ContainsUserName,
|
||||
kind: PushRuleKind.ContentSpecific,
|
||||
enabled: true,
|
||||
actions: userMentionActions,
|
||||
});
|
||||
|
||||
const roomMentionActions = model.mentions.room ? StandardActions.ACTION_NOTIFY : StandardActions.ACTION_DONT_NOTIFY;
|
||||
if (supportsIntentionalMentions) {
|
||||
standardRules.set(RuleId.IsRoomMention, {
|
||||
rule_id: RuleId.IsRoomMention,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: true,
|
||||
actions: roomMentionActions,
|
||||
});
|
||||
}
|
||||
standardRules.set(RuleId.AtRoomNotification, {
|
||||
rule_id: RuleId.AtRoomNotification,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: true,
|
||||
actions: roomMentionActions,
|
||||
});
|
||||
|
||||
standardRules.set(RuleId.Tombstone, {
|
||||
rule_id: RuleId.Tombstone,
|
||||
kind: PushRuleKind.Override,
|
||||
enabled: model.activity.status_event,
|
||||
actions: StandardActions.ACTION_HIGHLIGHT,
|
||||
});
|
||||
|
||||
standardRules.set(RuleId.IncomingCall, {
|
||||
rule_id: RuleId.IncomingCall,
|
||||
kind: PushRuleKind.Underride,
|
||||
enabled: true,
|
||||
actions: NotificationUtils.encodeActions({
|
||||
notify: true,
|
||||
sound: model.sound.calls,
|
||||
}),
|
||||
});
|
||||
|
||||
return standardRules;
|
||||
}
|
||||
|
||||
export function reconcileNotificationSettings(
|
||||
pushRules: IPushRules,
|
||||
model: NotificationSettings,
|
||||
supportsIntentionalMentions: boolean,
|
||||
): PushRuleDiff {
|
||||
const changes: PushRuleDiff = {
|
||||
updated: [],
|
||||
added: [],
|
||||
deleted: [],
|
||||
};
|
||||
|
||||
const oldRules = buildPushRuleMap(pushRules);
|
||||
const newRules = toStandardRules(model, supportsIntentionalMentions);
|
||||
|
||||
for (const rule of newRules.values()) {
|
||||
const original = oldRules.get(rule.rule_id);
|
||||
let changed = false;
|
||||
if (original === undefined) {
|
||||
changed = true;
|
||||
} else if (rule.enabled !== undefined && rule.enabled !== original.enabled) {
|
||||
changed = true;
|
||||
} else if (rule.actions !== undefined) {
|
||||
const originalActions = NotificationUtils.decodeActions(original.actions);
|
||||
const actions = NotificationUtils.decodeActions(rule.actions);
|
||||
if (originalActions === null || actions === null) {
|
||||
changed = true;
|
||||
} else if (!deepCompare(actions, originalActions)) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
changes.updated.push(rule);
|
||||
}
|
||||
}
|
||||
|
||||
const mentionActions = NotificationUtils.encodeActions({
|
||||
notify: true,
|
||||
sound: model.sound.mentions,
|
||||
highlight: true,
|
||||
});
|
||||
const contentRules = pushRules.global.content?.filter((rule) => !rule.rule_id.startsWith(".")) ?? [];
|
||||
const newKeywords = new Set(model.keywords);
|
||||
for (const rule of contentRules) {
|
||||
if (!newKeywords.has(rule.pattern!)) {
|
||||
changes.deleted.push({
|
||||
rule_id: rule.rule_id,
|
||||
kind: PushRuleKind.ContentSpecific,
|
||||
});
|
||||
} else {
|
||||
let changed = false;
|
||||
if (rule.enabled !== model.mentions.keywords) {
|
||||
changed = true;
|
||||
} else if (rule.actions !== undefined) {
|
||||
const originalActions = NotificationUtils.decodeActions(rule.actions);
|
||||
const actions = NotificationUtils.decodeActions(mentionActions);
|
||||
if (originalActions === null || actions === null) {
|
||||
changed = true;
|
||||
} else if (!deepCompare(actions, originalActions)) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
changes.updated.push({
|
||||
rule_id: rule.rule_id,
|
||||
kind: PushRuleKind.ContentSpecific,
|
||||
enabled: model.mentions.keywords,
|
||||
actions: mentionActions,
|
||||
});
|
||||
}
|
||||
}
|
||||
newKeywords.delete(rule.pattern!);
|
||||
}
|
||||
for (const keyword of newKeywords) {
|
||||
changes.added.push({
|
||||
rule_id: keyword,
|
||||
kind: PushRuleKind.ContentSpecific,
|
||||
default: false,
|
||||
enabled: model.mentions.keywords,
|
||||
pattern: keyword,
|
||||
actions: mentionActions,
|
||||
});
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import { type IPushRule, type IPushRules, RuleId } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { NotificationUtils } from "../../notifications";
|
||||
import { RoomNotifState } from "../../RoomNotifs";
|
||||
import { type NotificationSettings } from "./NotificationSettings";
|
||||
import { buildPushRuleMap } from "./PushRuleMap";
|
||||
|
||||
function shouldNotify(rules: (IPushRule | null | undefined | false)[]): boolean {
|
||||
if (rules.length === 0) {
|
||||
return true;
|
||||
}
|
||||
for (const rule of rules) {
|
||||
if (rule === null || rule === undefined || rule === false || !rule.enabled) {
|
||||
continue;
|
||||
}
|
||||
const actions = NotificationUtils.decodeActions(rule.actions);
|
||||
if (actions !== null && actions.notify) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMuted(rules: (IPushRule | null | undefined | false)[]): boolean {
|
||||
if (rules.length === 0) {
|
||||
return false;
|
||||
}
|
||||
for (const rule of rules) {
|
||||
if (rule === null || rule === undefined || rule === false || !rule.enabled) {
|
||||
continue;
|
||||
}
|
||||
const actions = NotificationUtils.decodeActions(rule.actions);
|
||||
if (actions !== null && !actions.notify && actions.highlight !== true && actions.sound === undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function determineSound(rules: (IPushRule | null | undefined | false)[]): string | undefined {
|
||||
for (const rule of rules) {
|
||||
if (rule === null || rule === undefined || rule === false || !rule.enabled) {
|
||||
continue;
|
||||
}
|
||||
const actions = NotificationUtils.decodeActions(rule.actions);
|
||||
if (actions !== null && actions.notify && actions.sound !== undefined) {
|
||||
return actions.sound;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function toNotificationSettings(
|
||||
pushRules: IPushRules,
|
||||
supportsIntentionalMentions: boolean,
|
||||
): NotificationSettings {
|
||||
const standardRules = buildPushRuleMap(pushRules);
|
||||
const contentRules = pushRules.global.content?.filter((rule) => !rule.rule_id.startsWith(".")) ?? [];
|
||||
const dmRules = [standardRules.get(RuleId.DM), standardRules.get(RuleId.EncryptedDM)];
|
||||
const roomRules = [standardRules.get(RuleId.Message), standardRules.get(RuleId.EncryptedMessage)];
|
||||
return {
|
||||
globalMute: standardRules.get(RuleId.Master)?.enabled ?? false,
|
||||
defaultLevels: {
|
||||
room: shouldNotify(roomRules) ? RoomNotifState.AllMessages : RoomNotifState.MentionsOnly,
|
||||
dm: shouldNotify(dmRules) ? RoomNotifState.AllMessages : RoomNotifState.MentionsOnly,
|
||||
},
|
||||
sound: {
|
||||
calls: determineSound([standardRules.get(RuleId.IncomingCall)]),
|
||||
mentions: determineSound([
|
||||
supportsIntentionalMentions && standardRules.get(RuleId.IsUserMention),
|
||||
standardRules.get(RuleId.ContainsUserName),
|
||||
standardRules.get(RuleId.ContainsDisplayName),
|
||||
...contentRules,
|
||||
]),
|
||||
people: determineSound(dmRules),
|
||||
},
|
||||
activity: {
|
||||
bot_notices: !isMuted([standardRules.get(RuleId.SuppressNotices)]),
|
||||
invite: shouldNotify([standardRules.get(RuleId.InviteToSelf)]),
|
||||
status_event: shouldNotify([standardRules.get(RuleId.MemberEvent), standardRules.get(RuleId.Tombstone)]),
|
||||
},
|
||||
mentions: {
|
||||
user: shouldNotify([
|
||||
supportsIntentionalMentions && standardRules.get(RuleId.IsUserMention),
|
||||
standardRules.get(RuleId.ContainsUserName),
|
||||
standardRules.get(RuleId.ContainsDisplayName),
|
||||
]),
|
||||
room: shouldNotify([
|
||||
supportsIntentionalMentions && standardRules.get(RuleId.IsRoomMention),
|
||||
standardRules.get(RuleId.AtRoomNotification),
|
||||
]),
|
||||
keywords: shouldNotify(contentRules),
|
||||
},
|
||||
keywords: contentRules.map((it) => it.pattern!),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright 2024 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 type PresenceState = "offline" | "online" | "unavailable" | "io.element.unreachable";
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 2024 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.
|
||||
*/
|
||||
|
||||
import { type PresenceState } from "./PresenceState";
|
||||
|
||||
export type RoomMember = {
|
||||
roomId: string;
|
||||
userId: string;
|
||||
displayUserId: string;
|
||||
name: string;
|
||||
rawDisplayName?: string;
|
||||
disambiguate: boolean;
|
||||
avatarThumbnailUrl?: string;
|
||||
powerLevel: number;
|
||||
lastModifiedTime: number;
|
||||
presenceState?: PresenceState;
|
||||
isInvite: boolean;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Copyright 2024 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.
|
||||
*/
|
||||
|
||||
import { type MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
export type ThreePIDInvite = {
|
||||
event: MatrixEvent;
|
||||
};
|
||||
Reference in New Issue
Block a user