Merge inbox (#10057)

This commit is contained in:
Kristina
2025-10-22 09:14:35 +07:00
committed by GitHub
parent d5e69ed22b
commit e3c095ae4c
131 changed files with 3844 additions and 1100 deletions
@@ -219,6 +219,31 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
}
}
async removeAllNotifications (): Promise<void> {
const ops = getClient().apply(undefined, 'removeAllNotifications', true)
try {
const inboxNotifications = await ops.findAll(
notification.class.InboxNotification,
{
user: getCurrentAccount().uuid,
archived: false
},
{ projection: { _id: 1, _class: 1, space: 1 } }
)
const contexts = get(this.contexts) ?? []
for (const notification of inboxNotifications) {
await ops.removeDoc(notification._class, notification.space, notification._id)
}
for (const context of contexts) {
await ops.update(context, { lastViewedTimestamp: Date.now() })
}
} finally {
await ops.commit()
}
}
async archiveAllNotifications (): Promise<void> {
const ops = getClient().apply(undefined, 'archiveAllNotifications', true)