Skip to content

fix: add someone for anonymous user display #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ ui:
achievement: Achievements
all_read: Mark all as read
show_more: Show more
someone: Someone
suspended:
title: Your Account has been Suspended
until_time: "Your account was suspended until {{ time }}."
Expand Down
1 change: 1 addition & 0 deletions i18n/zh_CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ ui:
achievement: 成就
all_read: 全部标记为已读
show_more: 显示更多
someone: 有人
suspended:
title: 账号已封禁
until_time: "你的账号被封禁至{{ time }}。"
Expand Down
7 changes: 5 additions & 2 deletions ui/src/pages/Users/Notifications/components/Inbox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { ListGroup } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

import classNames from 'classnames';
import { isEmpty } from 'lodash';

import { FormatTime, Empty } from '@/components';

const Inbox = ({ data, handleReadNotification }) => {
const { t } = useTranslation('translation', { keyPrefix: 'notifications' });
if (!data) {
return null;
}
Expand Down Expand Up @@ -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)}>
Expand Down