Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(web): keep bulk notification reads in active workspace
Akshar Patelaf9189c04a0f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex e13474724..fd362b84c 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -136,6 +136,7 @@ jobs:__tests__/unit/media-format-converter-selection.test.ts__tests__/unit/media-format-converter.test.ts__tests__/unit/media-player-store-refs.test.ts+ __tests__/unit/notification-read-state.test.ts__tests__/unit/playback-store.test.ts__tests__/unit/seo-demo-videos.test.ts__tests__/unit/signed-baa-card.test.tsdiff --git a/apps/web/__tests__/unit/notification-read-state.test.ts b/apps/web/__tests__/unit/notification-read-state.test.tsindex 3edbf65f1..e3e3c9d0f 100644--- a/apps/web/__tests__/unit/notification-read-state.test.ts+++ b/apps/web/__tests__/unit/notification-read-state.test.ts@@ -19,7 +19,10 @@ vi.mock("next/cache", () => ({ revalidatePath: mocks.revalidatePath }));import { markAsRead } from "@/actions/notifications/mark-as-read";beforeEach(() => {- mocks.getCurrentUser.mockResolvedValue({ id: "user-1" });+ mocks.getCurrentUser.mockResolvedValue({+ id: "user-1",+ activeOrganizationId: "org-1",+ });mocks.query.mockResolvedValue({ rows: [{ affectedRows: 1, insertId: 0 }] });});@@ -40,12 +43,14 @@ describe("notification read state", () => {},);- it("marks all notifications for the current recipient when no ID is supplied", async () => {+ it("marks all notifications for the current recipient in the active organization", async () => {await markAsRead();expect(mocks.query).toHaveBeenCalledExactlyOnceWith(- "update `notifications` set `readAt` = ? where `notifications`.`recipientId` = ?",- [expect.any(String), "user-1"],+ expect.stringMatching(+ /where .*`notifications`\.`recipientId` = \?.*`notifications`\.`orgId` = \?/,+ ),+ [expect.any(String), "user-1", "org-1"],"execute",);expect(mocks.revalidatePath).toHaveBeenCalledWith("/dashboard");diff --git a/apps/web/actions/notifications/mark-as-read.ts b/apps/web/actions/notifications/mark-as-read.tsindex b3904d548..d3445b622 100644--- a/apps/web/actions/notifications/mark-as-read.ts+++ b/apps/web/actions/notifications/mark-as-read.ts@@ -20,7 +20,9 @@ export const markAsRead = async (notificationId?: string) => {.where(and(eq(notifications.recipientId, currentUser.id),- notificationId ? eq(notifications.id, notificationId) : undefined,+ notificationId+ ? eq(notifications.id, notificationId)+ : eq(notifications.orgId, currentUser.activeOrganizationId),),);} catch (error) {