From c78d1c49abc6b278f16e289681ed61a7d3f5dd0e Mon Sep 17 00:00:00 2001
From: Will Hunt <willh@matrix.org>
Date: Wed, 24 Feb 2021 17:32:00 +0000
Subject: [PATCH] Apply changes from review

---
 src/components/structures/LoggedInView.tsx | 4 ++--
 src/toasts/ServerLimitToast.tsx            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx
index f3cce3ef34..c01214f3f4 100644
--- a/src/components/structures/LoggedInView.tsx
+++ b/src/components/structures/LoggedInView.tsx
@@ -305,7 +305,7 @@ class LoggedInView extends React.Component<IProps, IState> {
         }
     };
 
-    _onHideToast = () => {
+    private onUsageLimitDismissed = () => {
         this.setState({
             usageLimitDismissed: true,
         });
@@ -322,7 +322,7 @@ class LoggedInView extends React.Component<IProps, IState> {
         if (usageLimitEventContent && this.state.usageLimitDismissed) {
             showServerLimitToast(
                 usageLimitEventContent.limit_type,
-                this._onHideToast,
+                this.onUsageLimitDismissed,
                 usageLimitEventContent.admin_contact,
                 error,
             );
diff --git a/src/toasts/ServerLimitToast.tsx b/src/toasts/ServerLimitToast.tsx
index 068d62f9ea..28c0ec9598 100644
--- a/src/toasts/ServerLimitToast.tsx
+++ b/src/toasts/ServerLimitToast.tsx
@@ -40,7 +40,7 @@ export const showToast = (limitType: string, onHideToast: () => void, adminConta
             acceptLabel: _t("Ok"),
             onAccept: () => {
                 hideToast()
-                onHideToast()
+                if (onHideToast) { onHideToast() }
             },
         },
         component: GenericToast,