Skip to content

Commit

Permalink
Fix crash in skip message (#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Sep 29, 2024
1 parent 8900d79 commit 2d69277
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/Chat/NotificationMessages/SkipMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ function SkipMessage({
}: SkipMessageProps) {
const { t } = useTranslator();

try {
// eslint-disable-next-line no-param-reassign
reason = t(`booth.skip.reasons.${reason}`);
} catch {
// Not great to use try/catch for this, but not adding new APIs to `@u-wave/translate`
}

return (
<UserNotificationMessage
type="skip"
className="ChatMessage--skip"
i18nKey={getLangKey(!!moderator, !!reason)}
i18nProps={{
djName: <Username user={user} />,
reason: reason ? t(`booth.skip.reasons.${reason}`) : undefined,
reason,
}}
user={moderator ?? user}
timestamp={timestamp}
Expand Down

0 comments on commit 2d69277

Please sign in to comment.