feat(server): support read all notifications (#13083)

close AF-2719



#### PR Dependency Tree


* **PR #13083** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added the ability to mark all notifications as read with a single
action.
  
* **Bug Fixes**
  * Ensured notifications marked as read are no longer shown as unread.

* **Tests**
* Introduced new tests to verify the functionality of marking all
notifications as read.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
fengmk2
2025-07-08 15:19:45 +08:00
committed by GitHub
parent 6fd9524521
commit db79c00ea7
9 changed files with 122 additions and 0 deletions
@@ -8,6 +8,7 @@ import {
notificationCountQuery,
NotificationObjectType,
NotificationType,
readAllNotificationsMutation,
readNotificationMutation,
} from '@affine/graphql';
@@ -677,3 +678,41 @@ e2e('should list and count notifications', async t => {
t.is(result3.currentUser!.notifications.edges.length, 0);
}
});
e2e('should mark all notifications as read', async t => {
const { member, owner, workspace } = await init();
await app.login(owner);
await app.gql({
query: mentionUserMutation,
variables: {
input: {
userId: member.id,
workspaceId: workspace.id,
doc: {
id: 'doc-id-1',
title: 'doc-title-1',
blockId: 'block-id-1',
mode: DocMode.page,
},
},
},
});
await app.login(member);
await app.gql({
query: readAllNotificationsMutation,
});
const result = await app.gql({
query: listNotificationsQuery,
variables: {
pagination: {
first: 10,
offset: 0,
},
},
});
t.is(result.currentUser!.notifications.totalCount, 0);
});