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

Commit

Permalink
Minor strict type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Jun 13, 2023
1 parent c9187d2 commit af2b5aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/views/right_panel/EncryptionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
}, [verificationRequestPromise]);
const changeHandler = useCallback(() => {
// handle transitions -> cancelled for mismatches which fire a modal instead of showing a card
if (request && request.phase === VerificationPhase.Cancelled && MISMATCHES.includes(request.cancellationCode)) {
if (
request &&
request.phase === VerificationPhase.Cancelled &&
MISMATCHES.includes(request.cancellationCode ?? "")
) {
Modal.createDialog(ErrorDialog, {
headerImage: require("../../../../res/img/e2e/warning-deprecated.svg").default,
title: _t("Your messages are not secure"),
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/toasts/VerificationRequestToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface IProps {
}

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

public constructor(props: IProps) {
super(props);
this.state = { counter: Math.ceil(props.request.timeout / 1000) };
this.state = { counter: Math.ceil((props.request.timeout ?? 0) / 1000) };
}

public async componentDidMount(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`VerificationRequestToast should render a cross-user verification 1`] =
role="button"
tabindex="0"
>
Ignore (NaN)
Ignore
</div>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
Expand Down Expand Up @@ -53,7 +53,7 @@ exports[`VerificationRequestToast should render a self-verification 1`] = `
role="button"
tabindex="0"
>
Ignore (NaN)
Ignore
</div>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
Expand Down

0 comments on commit af2b5aa

Please sign in to comment.