1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Remove deprecated calls of MatrixClient (#4563)

This commit is contained in:
Florian Duros
2024-11-29 10:49:52 +01:00
committed by GitHub
parent 125e45c24d
commit 97ef1dc6df
2 changed files with 6 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import { RelationType } from "../@types/event.ts";
import { TypedEventEmitter } from "./typed-event-emitter.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts";
import { MatrixClient } from "../client.ts"; import { MatrixClient } from "../client.ts";
import { Room } from "./room.ts"; import { Room } from "./room.ts";
import { CryptoBackend } from "../common-crypto/CryptoBackend.ts";
export enum RelationsEvent { export enum RelationsEvent {
Add = "Relations.add", Add = "Relations.add",
@@ -323,8 +324,9 @@ export class Relations extends TypedEventEmitter<RelationsEvent, EventHandlerMap
return event; return event;
}, null); }, null);
if (lastReplacement?.shouldAttemptDecryption() && this.client.isCryptoEnabled()) { if (lastReplacement?.shouldAttemptDecryption() && this.client.getCrypto()) {
await lastReplacement.attemptDecryption(this.client.crypto!); // Dirty but we are expecting to pass the cryptoBackend which is not accessible here
await lastReplacement.attemptDecryption(this.client.getCrypto() as CryptoBackend);
} else if (lastReplacement?.isBeingDecrypted()) { } else if (lastReplacement?.isBeingDecrypted()) {
await lastReplacement.getDecryptionPromise(); await lastReplacement.getDecryptionPromise();
} }

View File

@@ -545,7 +545,7 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
* @returns Signals when all events have been decrypted * @returns Signals when all events have been decrypted
*/ */
public async decryptCriticalEvents(): Promise<void> { public async decryptCriticalEvents(): Promise<void> {
if (!this.client.isCryptoEnabled()) return; if (!this.client.getCrypto()) return;
const readReceiptEventId = this.getEventReadUpTo(this.client.getUserId()!, true); const readReceiptEventId = this.getEventReadUpTo(this.client.getUserId()!, true);
const events = this.getLiveTimeline().getEvents(); const events = this.getLiveTimeline().getEvents();
@@ -567,7 +567,7 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
* @returns Signals when all events have been decrypted * @returns Signals when all events have been decrypted
*/ */
public async decryptAllEvents(): Promise<void> { public async decryptAllEvents(): Promise<void> {
if (!this.client.isCryptoEnabled()) return; if (!this.client.getCrypto()) return;
const decryptionPromises = this.getUnfilteredTimelineSet() const decryptionPromises = this.getUnfilteredTimelineSet()
.getLiveTimeline() .getLiveTimeline()