You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +03:00
Remove deprecated calls of MatrixClient
(#4563)
This commit is contained in:
@@ -20,6 +20,7 @@ import { RelationType } from "../@types/event.ts";
|
||||
import { TypedEventEmitter } from "./typed-event-emitter.ts";
|
||||
import { MatrixClient } from "../client.ts";
|
||||
import { Room } from "./room.ts";
|
||||
import { CryptoBackend } from "../common-crypto/CryptoBackend.ts";
|
||||
|
||||
export enum RelationsEvent {
|
||||
Add = "Relations.add",
|
||||
@@ -323,8 +324,9 @@ export class Relations extends TypedEventEmitter<RelationsEvent, EventHandlerMap
|
||||
return event;
|
||||
}, null);
|
||||
|
||||
if (lastReplacement?.shouldAttemptDecryption() && this.client.isCryptoEnabled()) {
|
||||
await lastReplacement.attemptDecryption(this.client.crypto!);
|
||||
if (lastReplacement?.shouldAttemptDecryption() && this.client.getCrypto()) {
|
||||
// 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()) {
|
||||
await lastReplacement.getDecryptionPromise();
|
||||
}
|
||||
|
@@ -545,7 +545,7 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
|
||||
* @returns Signals when all events have been decrypted
|
||||
*/
|
||||
public async decryptCriticalEvents(): Promise<void> {
|
||||
if (!this.client.isCryptoEnabled()) return;
|
||||
if (!this.client.getCrypto()) return;
|
||||
|
||||
const readReceiptEventId = this.getEventReadUpTo(this.client.getUserId()!, true);
|
||||
const events = this.getLiveTimeline().getEvents();
|
||||
@@ -567,7 +567,7 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
|
||||
* @returns Signals when all events have been decrypted
|
||||
*/
|
||||
public async decryptAllEvents(): Promise<void> {
|
||||
if (!this.client.isCryptoEnabled()) return;
|
||||
if (!this.client.getCrypto()) return;
|
||||
|
||||
const decryptionPromises = this.getUnfilteredTimelineSet()
|
||||
.getLiveTimeline()
|
||||
|
Reference in New Issue
Block a user