From 4091e619538a9f59d884bf1115a2204d757b39a2 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Thu, 30 May 2024 12:00:55 +0530 Subject: [PATCH] fix: notification mark all as read (#4643) --- packages/types/src/notifications.d.ts | 2 +- web/hooks/use-user-notifications.tsx | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/types/src/notifications.d.ts b/packages/types/src/notifications.d.ts index 571b757655..d739b23095 100644 --- a/packages/types/src/notifications.d.ts +++ b/packages/types/src/notifications.d.ts @@ -57,7 +57,7 @@ export interface INotificationIssueLite { state_group: string; } -export type NotificationType = "created" | "assigned" | "watching" | null; +export type NotificationType = "created" | "assigned" | "watching" | "all"; export interface INotificationParams { snoozed?: boolean; diff --git a/web/hooks/use-user-notifications.tsx b/web/hooks/use-user-notifications.tsx index 81681bd373..19f150b886 100644 --- a/web/hooks/use-user-notifications.tsx +++ b/web/hooks/use-user-notifications.tsx @@ -3,14 +3,13 @@ import { useRouter } from "next/router"; // swr import useSWR from "swr"; import useSWRInfinite from "swr/infinite"; -// services -import { UNREAD_NOTIFICATIONS_COUNT, getPaginatedNotificationKey } from "@/constants/fetch-keys"; -import { NotificationService } from "@/services/notification.service"; -// fetch-keys -// type import type { NotificationType, NotificationCount, IMarkAllAsReadPayload } from "@plane/types"; // ui import { TOAST_TYPE, setToast } from "@plane/ui"; +// constant +import { UNREAD_NOTIFICATIONS_COUNT, getPaginatedNotificationKey } from "@/constants/fetch-keys"; +// services +import { NotificationService } from "@/services/notification.service"; const PER_PAGE = 30; @@ -258,7 +257,7 @@ const useUserNotification = (): any => { if (snoozed) markAsReadParams = { archived: false, snoozed: true }; else if (archived) markAsReadParams = { archived: true, snoozed: false }; - else markAsReadParams = { archived: false, snoozed: false, type: selectedTab }; + else markAsReadParams = { archived: false, snoozed: false, type: readNotification ? "all" : selectedTab }; await userNotificationServices .markAllNotificationsAsRead(workspaceSlug.toString(), markAsReadParams)