Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit af2b5aa

Browse files
committed
Minor strict type fixes
1 parent c9187d2 commit af2b5aa

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/components/views/right_panel/EncryptionPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
7171
}, [verificationRequestPromise]);
7272
const changeHandler = useCallback(() => {
7373
// handle transitions -> cancelled for mismatches which fire a modal instead of showing a card
74-
if (request && request.phase === VerificationPhase.Cancelled && MISMATCHES.includes(request.cancellationCode)) {
74+
if (
75+
request &&
76+
request.phase === VerificationPhase.Cancelled &&
77+
MISMATCHES.includes(request.cancellationCode ?? "")
78+
) {
7579
Modal.createDialog(ErrorDialog, {
7680
headerImage: require("../../../../res/img/e2e/warning-deprecated.svg").default,
7781
title: _t("Your messages are not secure"),

src/components/views/toasts/VerificationRequestToast.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ interface IProps {
4242
}
4343

4444
interface IState {
45+
/** number of seconds left in the timeout counter. Zero if there is no timeout. */
4546
counter: number;
4647
device?: DeviceInfo;
4748
ip?: string;
@@ -52,7 +53,7 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
5253

5354
public constructor(props: IProps) {
5455
super(props);
55-
this.state = { counter: Math.ceil(props.request.timeout / 1000) };
56+
this.state = { counter: Math.ceil((props.request.timeout ?? 0) / 1000) };
5657
}
5758

5859
public async componentDidMount(): Promise<void> {

test/components/views/toasts/__snapshots__/VerificationRequestToast-test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports[`VerificationRequestToast should render a cross-user verification 1`] =
1717
role="button"
1818
tabindex="0"
1919
>
20-
Ignore (NaN)
20+
Ignore
2121
</div>
2222
<div
2323
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
@@ -53,7 +53,7 @@ exports[`VerificationRequestToast should render a self-verification 1`] = `
5353
role="button"
5454
tabindex="0"
5555
>
56-
Ignore (NaN)
56+
Ignore
5757
</div>
5858
<div
5959
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"

0 commit comments

Comments
 (0)