Fix move notifications

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-04-28 19:59:55 +02:00
parent 67694c48d9
commit 9af1ab026c
1 changed files with 6 additions and 4 deletions

View File

@ -95,14 +95,14 @@ const messages: Record<NotificationType, { id: string, defaultMessage: string }>
}, },
}; };
const buildMessage = (type: NotificationType, account: Account): JSX.Element => { const buildMessage = (type: NotificationType, account: Account, targetName?: string): JSX.Element => {
const link = buildLink(account); const link = buildLink(account);
return ( return (
<FormattedMessageFixed <FormattedMessageFixed
id={messages[type].id} id={messages[type].id}
defaultMessage={messages[type].defaultMessage} defaultMessage={messages[type].defaultMessage}
values={{ name: link }} values={{ name: link, targetName }}
/> />
); );
}; };
@ -257,7 +257,9 @@ const Notification: React.FC<INotificaton> = (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 ( return (
<HotKeys handlers={getHandlers()} data-testid='notification'> <HotKeys handlers={getHandlers()} data-testid='notification'>
@ -273,7 +275,7 @@ const Notification: React.FC<INotificaton> = (props) => {
}, },
{ {
name: account && typeof account === 'object' ? account.acct : '', name: account && typeof account === 'object' ? account.acct : '',
targetName: notification.target && typeof notification.target === 'object' ? notification.target.acct : '', targetName,
}), }),
notification.created_at, notification.created_at,
) )