A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: add someone for anonymous user display
shuai016fd7b41241
diff --git a/i18n/en_US.yaml b/i18n/en_US.yamlindex 86a76653..c7382b36 100644--- a/i18n/en_US.yaml+++ b/i18n/en_US.yaml@@ -332,6 +332,7 @@ ui:achievement: Achievementsall_read: Mark all as readshow_more: Show more+ someone: Someonesuspended:title: Your Account has been Suspendeduntil_time: "Your account was suspended until {{ time }}."diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yamlindex 6f92c164..1aa91395 100644--- a/i18n/zh_CN.yaml+++ b/i18n/zh_CN.yaml@@ -316,6 +316,7 @@ ui:achievement: 成就all_read: 全部标记为已读show_more: 显示更多+ someone: 有人suspended:title: 账号已封禁until_time: "你的账号被封禁至{{ time }}。"diff --git a/ui/src/pages/Users/Notifications/components/Inbox/index.tsx b/ui/src/pages/Users/Notifications/components/Inbox/index.tsxindex aafaea5a..71b69f06 100644--- a/ui/src/pages/Users/Notifications/components/Inbox/index.tsx+++ b/ui/src/pages/Users/Notifications/components/Inbox/index.tsx@@ -1,5 +1,6 @@import { ListGroup } from 'react-bootstrap';import { Link } from 'react-router-dom';+import { useTranslation } from 'react-i18next';import classNames from 'classnames';import { isEmpty } from 'lodash';@@ -7,6 +8,7 @@ import { isEmpty } from 'lodash';import { FormatTime, Empty } from '@/components';const Inbox = ({ data, handleReadNotification }) => {+ const { t } = useTranslation('translation', { keyPrefix: 'notifications' });if (!data) {return null;}@@ -40,12 +42,13 @@ const Inbox = ({ data, handleReadNotification }) => {!item.is_read && 'warning',)}><div>- {item.user_info.status !== 'deleted' ? (+ {item.user_info && item.user_info.status !== 'deleted' ? (<Link to={`/users/${item.user_info.username}`}>{item.user_info.display_name}{' '}</Link>) : (- <span>{item.user_info.display_name} </span>+ // someone for anonymous user display+ <span>{item.user_info?.display_name || t('someone')} </span>)}{item.notification_action}{' '}<Link to={url} onClick={() => handleReadNotification(item.id)}>