mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 12:17:44 +02:00
Add archive all button in inbox (#4870)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -20,7 +20,8 @@ import {
|
||||
type Doc,
|
||||
type Ref,
|
||||
type TxOperations,
|
||||
type WithLookup
|
||||
type WithLookup,
|
||||
generateId
|
||||
} from '@hcengineering/core'
|
||||
import notification, {
|
||||
type ActivityInboxNotification,
|
||||
@@ -29,7 +30,7 @@ import notification, {
|
||||
type InboxNotification,
|
||||
type InboxNotificationsClient
|
||||
} from '@hcengineering/notification'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { derived, get, writable } from 'svelte/store'
|
||||
|
||||
export const inboxMessagesStore = writable<ActivityMessage[]>([])
|
||||
@@ -250,4 +251,19 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
await client.remove(notification)
|
||||
}
|
||||
}
|
||||
|
||||
async deleteAllNotifications (): Promise<void> {
|
||||
const doneOp = await getClient().measure('deleteAllNotifications')
|
||||
const ops = getClient().apply(generateId())
|
||||
|
||||
try {
|
||||
const inboxNotifications = get(this.inboxNotifications) ?? []
|
||||
for (const notification of inboxNotifications) {
|
||||
await ops.remove(notification)
|
||||
}
|
||||
} finally {
|
||||
await ops.commit()
|
||||
await doneOp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user