mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 13:35:04 +02:00
Merge inbox (#10057)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user