You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Throw error if missing userId in CryptoApi.findVerificationRequestDMInProgress (#3641)
This commit is contained in:
@@ -578,9 +578,11 @@ describe("RustCrypto", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("findVerificationRequestDMInProgress", () => {
|
describe("findVerificationRequestDMInProgress", () => {
|
||||||
it("returns undefined if the userId is not provided", async () => {
|
it("throws an error if the userId is not provided", async () => {
|
||||||
const rustCrypto = await makeTestRustCrypto();
|
const rustCrypto = await makeTestRustCrypto();
|
||||||
expect(rustCrypto.findVerificationRequestDMInProgress(testData.TEST_ROOM_ID)).not.toBeDefined();
|
expect(() => rustCrypto.findVerificationRequestDMInProgress(testData.TEST_ROOM_ID)).toThrow(
|
||||||
|
"missing userId",
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -686,8 +686,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public findVerificationRequestDMInProgress(roomId: string, userId?: string): VerificationRequest | undefined {
|
public findVerificationRequestDMInProgress(roomId: string, userId?: string): VerificationRequest | undefined {
|
||||||
// TODO raise an error
|
if (!userId) throw new Error("missing userId");
|
||||||
if (!userId) return;
|
|
||||||
|
|
||||||
const requests: RustSdkCryptoJs.VerificationRequest[] = this.olmMachine.getVerificationRequests(
|
const requests: RustSdkCryptoJs.VerificationRequest[] = this.olmMachine.getVerificationRequests(
|
||||||
new RustSdkCryptoJs.UserId(userId),
|
new RustSdkCryptoJs.UserId(userId),
|
||||||
|
|||||||
Reference in New Issue
Block a user