Skip to content
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

fix: notification count showing wrong #1866

Merged
merged 1 commit into from
Sep 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function Notifications() {

console.debug('Metadata updated', notification.data);
if (!subscribedNotifications.METADATA_UPDATED) return;
ToastBatcher.showToast({ notification });
ToastBatcher.showToast({ notification, type: 'RAISE_HAND' });
break;
case HMSNotificationTypes.NAME_UPDATED:
console.log(notification.data.id + ' changed their name to ' + notification.data.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const ToastConfig = {
};
},
},
METADATA_UPDATED: {
RAISE_HAND: {
single: notification => {
return {
title: `${notification.data?.name} raised hand`,
Expand All @@ -118,10 +118,11 @@ export const ToastConfig = {
};
},
multiple: notifications => {
const count = new Set(notifications.map(notification => notification.data?.id)).size;
return {
title: `${notifications[notifications.length - 1].data?.name} and ${
notifications.length - 1
} others raised hand`,
title: `${notifications[notifications.length - 1].data?.name} ${
count > 1 ? `${count} and others` : ''
} raised hand`,
icon: <HandIcon />,
action: <HandRaiseAction isSingleHandRaise={false} />,
};
Expand Down