Remove matrix-events-sdk dependency (#31398)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-12-04 13:24:28 +00:00
committed by GitHub
parent d1f45da51a
commit e7be9d16b9
40 changed files with 70 additions and 106 deletions

View File

@@ -10,7 +10,6 @@ import { uniq } from "lodash";
import { type Room, type MatrixEvent, EventType, ClientEvent, type MatrixClient } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { logger } from "matrix-js-sdk/src/logger";
import { type Optional } from "matrix-events-sdk";
import { filterValidMDirect } from "./dm/filterValidMDirect";
@@ -170,7 +169,7 @@ export default class DMRoomMap {
return joinedRooms[0];
}
public getUserIdForRoomId(roomId: string): Optional<string> {
public getUserIdForRoomId(roomId: string): string | undefined {
if (this.roomToUser == null) {
// we lazily populate roomToUser so you can use
// this class just to call getDMRoomsForUserId

View File

@@ -27,7 +27,7 @@ function getSanitizedHtmlBody(content: IContent): string {
stripReplyFallback: true,
};
if (content.format === "org.matrix.custom.html") {
return bodyToHtml(content, null, opts);
return bodyToHtml(content, undefined, opts);
} else {
// convert the string to something that can be safely
// embedded in an html document, e.g. use html entities where needed
@@ -37,7 +37,7 @@ function getSanitizedHtmlBody(content: IContent): string {
// as opposed to bodyToHtml, here we also render
// text messages with dangerouslySetInnerHTML, to unify
// the code paths and because we need html to show differences
return textToHtml(bodyToHtml(content, null, opts));
return textToHtml(bodyToHtml(content, undefined, opts));
}
}

View File

@@ -7,7 +7,6 @@ Please see LICENSE files in the repository root for full details.
*/
import { type IInvite3PID, type MatrixClient, type Room } from "matrix-js-sdk/src/matrix";
import { type Optional } from "matrix-events-sdk";
import { Action } from "../../dispatcher/actions";
import { type ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
@@ -28,7 +27,7 @@ export async function startDm(client: MatrixClient, targets: Member[], showSpinn
const targetIds = targets.map((t) => t.userId);
// Check if there is already a DM with these people and reuse it if possible.
let existingRoom: Optional<Room>;
let existingRoom: Room | undefined;
if (targetIds.length === 1) {
existingRoom = findDMForUser(client, targetIds[0]);
} else {