Gracefully handle rate limit response when attempting to Sign in with QR (#11809)

* Gracefully hand rate limit response when attempting to Sign in with QR

* Don't cancel after rate limit

* Update src/components/views/auth/LoginWithQR.tsx

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* Add missing import

* Fix mock of error

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Hugh Nimmo-Smith 2024-01-11 16:11:47 +00:00 committed by GitHub
parent 6187c8c884
commit 54b71140b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 131 additions and 18 deletions

View file

@ -19,7 +19,12 @@ import React from "react";
import { RendezvousFailureReason } from "matrix-js-sdk/src/rendezvous";
import LoginWithQRFlow from "../../../../../src/components/views/auth/LoginWithQRFlow";
import { Click, Phase } from "../../../../../src/components/views/auth/LoginWithQR";
import {
Click,
Phase,
LoginWithQRFailureReason,
FailureReason,
} from "../../../../../src/components/views/auth/LoginWithQR";
describe("<LoginWithQRFlow />", () => {
const onClick = jest.fn();
@ -31,7 +36,7 @@ describe("<LoginWithQRFlow />", () => {
const getComponent = (props: {
phase: Phase;
onClick?: () => Promise<void>;
failureReason?: RendezvousFailureReason;
failureReason?: FailureReason;
code?: string;
confirmationDigits?: string;
}) => <LoginWithQRFlow {...defaultProps} {...props} />;
@ -97,7 +102,10 @@ describe("<LoginWithQRFlow />", () => {
});
describe("errors", () => {
for (const failureReason of Object.values(RendezvousFailureReason)) {
for (const failureReason of [
...Object.values(RendezvousFailureReason),
...Object.values(LoginWithQRFailureReason),
]) {
it(`renders ${failureReason}`, async () => {
const { container } = render(
getComponent({