1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Fix remaining hot paths

This commit is contained in:
Travis Ralston
2021-06-01 20:57:48 -06:00
parent e1edd84700
commit a1a6ec6dfa
3 changed files with 16 additions and 17 deletions

View File

@@ -667,7 +667,7 @@ export class MatrixClient extends EventEmitter {
}
return this.canResetTimelineCallback(roomId);
};
this.syncApi = new SyncApi(this, opts);
this.syncApi = new SyncApi(this, this.clientOpts);
this.syncApi.sync();
if (opts.clientWellKnownPollPeriod !== undefined) {
@@ -1420,6 +1420,13 @@ export class MatrixClient extends EventEmitter {
return this.crypto.beginKeyVerification(method, userId, deviceId);
}
public checkSecretStorageKey(key: any, info: any): Promise<any> { // TODO: Types
if (!this.crypto) {
throw new Error("End-to-end encryption disabled");
}
return this.crypto.checkSecretStorageKey(key, info);
}
/**
* Set the global override for whether the client should ever send encrypted
* messages to unverified devices. This provides the default for rooms which
@@ -4876,14 +4883,7 @@ export class MatrixClient extends EventEmitter {
highlights: [],
};
// TODO: @@TR: wtf is this
// prev:
/*
return this.search({ body: body }).then(
this._processRoomEventsSearch.bind(this, searchResults),
);
*/
return this.search({ body: body }).then(res => this.processRoomEventsSearch(res, searchResults));
return this.search({ body: body }).then(res => this.processRoomEventsSearch(searchResults, res));
}
/**
@@ -4911,12 +4911,11 @@ export class MatrixClient extends EventEmitter {
next_batch: searchResults.next_batch,
};
// TODO: @@TR: wtf
const promise = this.search(searchOpts).then(
this.processRoomEventsSearch.bind(this, searchResults),
).finally(() => {
searchResults.pendingRequest = null;
});
const promise = this.search(searchOpts)
.then(res => this.processRoomEventsSearch(searchResults, res))
.finally(() => {
searchResults.pendingRequest = null;
});
searchResults.pendingRequest = promise;
return promise;

View File

@@ -444,7 +444,7 @@ export class SecretStorage extends EventEmitter {
&& this._incomingRequests[deviceId][content.request_id]) {
logger.info("received request cancellation for secret (" + sender
+ ", " + deviceId + ", " + content.request_id + ")");
this.baseApis.emit("crypto.secrets.requestCancelled", {
this._baseApis.emit("crypto.secrets.requestCancelled", {
user_id: sender,
device_id: deviceId,
request_id: content.request_id,

View File

@@ -495,7 +495,7 @@ Crypto.prototype.bootstrapCrossSigning = async function({
} = {}) {
logger.log("Bootstrapping cross-signing");
const delegateCryptoCallbacks = this.baseApis.cryptoCallbacks;
const delegateCryptoCallbacks = this._baseApis.cryptoCallbacks;
const builder = new EncryptionSetupBuilder(
this._baseApis.store.accountData,
delegateCryptoCallbacks,