diff options
Diffstat (limited to 'packages/frontend/src/components/MkNotifications.vue')
| -rw-r--r-- | packages/frontend/src/components/MkNotifications.vue | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/packages/frontend/src/components/MkNotifications.vue b/packages/frontend/src/components/MkNotifications.vue index 874f1f90ea..1aea95fe0e 100644 --- a/packages/frontend/src/components/MkNotifications.vue +++ b/packages/frontend/src/components/MkNotifications.vue @@ -29,7 +29,6 @@ import { notificationTypes } from '@/const'; const props = defineProps<{ includeTypes?: typeof notificationTypes[number][]; - unreadOnly?: boolean; }>(); const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); @@ -40,23 +39,17 @@ const pagination: Paging = { params: computed(() => ({ includeTypes: props.includeTypes ?? undefined, excludeTypes: props.includeTypes ? undefined : $i.mutingNotificationTypes, - unreadOnly: props.unreadOnly, })), }; const onNotification = (notification) => { const isMuted = props.includeTypes ? !props.includeTypes.includes(notification.type) : $i.mutingNotificationTypes.includes(notification.type); if (isMuted || document.visibilityState === 'visible') { - stream.send('readNotification', { - id: notification.id, - }); + stream.send('readNotification'); } if (!isMuted) { - pagingComponent.value.prepend({ - ...notification, - isRead: document.visibilityState === 'visible', - }); + pagingComponent.value.prepend(notification); } }; @@ -65,30 +58,6 @@ let connection; onMounted(() => { connection = stream.useChannel('main'); connection.on('notification', onNotification); - connection.on('readAllNotifications', () => { - if (pagingComponent.value) { - for (const item of pagingComponent.value.queue) { - item.isRead = true; - } - for (const item of pagingComponent.value.items) { - item.isRead = true; - } - } - }); - connection.on('readNotifications', notificationIds => { - if (pagingComponent.value) { - for (let i = 0; i < pagingComponent.value.queue.length; i++) { - if (notificationIds.includes(pagingComponent.value.queue[i].id)) { - pagingComponent.value.queue[i].isRead = true; - } - } - for (let i = 0; i < (pagingComponent.value.items || []).length; i++) { - if (notificationIds.includes(pagingComponent.value.items[i].id)) { - pagingComponent.value.items[i].isRead = true; - } - } - } - }); }); onUnmounted(() => { |