Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
孙永强 committed Feb 27, 2025
1 parent 7975630 commit 1274273
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frontend/src/components/common/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ class Notification extends React.Component {
}
};

updateTotalUnseenCount = (noticeType) => {
if (noticeType === 'general') {
this.setState({
generalNoticeListUnseen: 0,
totalUnseenCount: this.state.discussionNoticeListUnseen
});
} else if (noticeType === 'discussion') {
this.setState({
discussionNoticeListUnseen: 0,
totalUnseenCount: this.state.generalNoticeListUnseen
});
}
};

render() {
const { totalUnseenCount, currentTab, generalNoticeList, discussionNoticeList, generalNoticeListUnseen, discussionNoticeListUnseen } = this.state;
return (
Expand Down Expand Up @@ -203,6 +217,7 @@ class Notification extends React.Component {
onNotificationDialogToggle={this.onNotificationDialogToggle}
generalNoticeListUnseen={generalNoticeListUnseen}
discussionNoticeListUnseen={discussionNoticeListUnseen}
updateTotalUnseenCount={this.updateTotalUnseenCount}
/>
}
</div>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/user-notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class UserNotificationsDialog extends React.Component {
return item;
})
});
this.props.updateTotalUnseenCount('general');
}).catch((error) => {
this.setState({
isLoading: false,
Expand All @@ -115,6 +116,7 @@ class UserNotificationsDialog extends React.Component {
return item;
})
});
this.props.updateTotalUnseenCount('discussion');
}).catch((error) => {
this.setState({
isLoading: false,
Expand All @@ -131,6 +133,7 @@ class UserNotificationsDialog extends React.Component {
this.setState({
items: []
});
this.props.updateTotalUnseenCount('general');
}).catch((error) => {
this.setState({
isLoading: false,
Expand All @@ -142,6 +145,7 @@ class UserNotificationsDialog extends React.Component {
this.setState({
items: []
});
this.props.updateTotalUnseenCount('discussion');
}).catch((error) => {
this.setState({
isLoading: false,
Expand Down

0 comments on commit 1274273

Please sign in to comment.