Skip to content

Commit

Permalink
fix notification
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Apr 25, 2024
1 parent b760874 commit a8085a7
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,30 @@ const DiscourseNotification = ({ notification, wrap, markRead }: DiscourseNotifi
}


if (Object.keys(notification.data).length !== 0) {
if (notification.post_number) {
result = renderTopicNotification(notification as AsktugNotification<TopicData>);
} else {
result = {
el: <span>{notification.fancy_title}</span>,
url: undefined,
if (!result) {
if (Object.keys(notification.data).length !== 0) {
if (notification.post_number) {
result = renderTopicNotification(notification as AsktugNotification<TopicData>);
}
}
}

let el = result?.el
const url = result?.url ?? '#';
if (!result) {
result = {
el: <span>{notification.fancy_title ?? `未知通知类型(${notification.notification_type})`}</span>,
url: undefined,
}
}

let el = result.el
const url = result.url ?? '#';

const onClick = useCallback((event) => {
if (!notification.read) {
markRead?.(notification.id)
}
}, [notification.read, notification.id, markRead])

if (!el) {
el = <>{notification.fancy_title ?? `未知通知类型(${notification.notification_type})`}</>
}

el = <span>{el}&nbsp;&nbsp;<LuxonDuration className='ti-asktug-notification__time' from={notification.created_at} suffix='前'/></span>
el = React.cloneElement(wrap ? wrap(el) : el, {
className: classnames('ti-asktug-notification', { 'ti-asktug-notification-read': notification.read }),
Expand Down

0 comments on commit a8085a7

Please sign in to comment.