From 9af1ab026cd1e2525ca8109d62b3b6d3de06166c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 28 Apr 2022 19:59:55 +0200 Subject: [PATCH] Fix move notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../features/notifications/components/notification.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/soapbox/features/notifications/components/notification.tsx b/app/soapbox/features/notifications/components/notification.tsx index 0cb961bd7..db6f02299 100644 --- a/app/soapbox/features/notifications/components/notification.tsx +++ b/app/soapbox/features/notifications/components/notification.tsx @@ -95,14 +95,14 @@ const messages: Record }, }; -const buildMessage = (type: NotificationType, account: Account): JSX.Element => { +const buildMessage = (type: NotificationType, account: Account, targetName?: string): JSX.Element => { const link = buildLink(account); return ( ); }; @@ -257,7 +257,9 @@ const Notification: React.FC = (props) => { } }; - const message: React.ReactNode = type && account && typeof account === 'object' ? buildMessage(type, account) : null; + const targetName = notification.target && typeof notification.target === 'object' ? notification.target.acct : ''; + + const message: React.ReactNode = type && account && typeof account === 'object' ? buildMessage(type, account, targetName) : null; return ( @@ -273,7 +275,7 @@ const Notification: React.FC = (props) => { }, { name: account && typeof account === 'object' ? account.acct : '', - targetName: notification.target && typeof notification.target === 'object' ? notification.target.acct : '', + targetName, }), notification.created_at, )