Skip to content

Commit

Permalink
fix: notification mark all as read (#4643)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored May 30, 2024
1 parent ade6ede commit 4091e61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/types/src/notifications.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions web/hooks/use-user-notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4091e61

Please sign in to comment.