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, )