From c4431c8c3e87eb10f848dacad41bdce10829a896 Mon Sep 17 00:00:00 2001 From: dougfabris Date: Thu, 23 Dec 2021 14:23:21 -0300 Subject: [PATCH] fix: addAction verification --- app/push-notifications/client/tabBar.ts | 13 +++---------- app/ui/client/lib/chatMessages.js | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/push-notifications/client/tabBar.ts b/app/push-notifications/client/tabBar.ts index c270fe648039..5fdfe372a1a8 100644 --- a/app/push-notifications/client/tabBar.ts +++ b/app/push-notifications/client/tabBar.ts @@ -4,21 +4,14 @@ import { useUserSubscription } from '../../../client/contexts/UserContext'; import { addAction } from '../../../client/views/room/lib/Toolbox'; addAction('push-notifications', ({ room }) => { - if (!room) { - return null; - } + const subscription = useUserSubscription(room?._id); - const subscription = useUserSubscription(room._id); - if (!subscription) { - return null; - } - - return useMemo(() => ({ + return useMemo(() => (subscription ? { groups: ['channel', 'group', 'direct', 'direct_multiple', 'team'], id: 'push-notifications', title: 'Notifications_Preferences', icon: 'bell', template: lazy(() => import('../../../client/views/room/contextualBar/NotificationPreferences')), order: 8, - }), []); + } : null), [subscription]); }); diff --git a/app/ui/client/lib/chatMessages.js b/app/ui/client/lib/chatMessages.js index bfc7ea5cfd6f..52f375b17a4a 100644 --- a/app/ui/client/lib/chatMessages.js +++ b/app/ui/client/lib/chatMessages.js @@ -594,7 +594,7 @@ export class ChatMessages { onDestroyed(rid, tmid) { UserAction.cancel(rid); - if (this.input.parentElement.classList.contains('editing') === true) { + if (this.input.parentElement?.classList.contains('editing') === true) { if (!tmid) { this.clearCurrentDraft(); this.clearEditing();