diff --git a/plugins/notification-assets/lang/en.json b/plugins/notification-assets/lang/en.json
index b24528cbe3..1da774f82e 100644
--- a/plugins/notification-assets/lang/en.json
+++ b/plugins/notification-assets/lang/en.json
@@ -35,6 +35,7 @@
"Pinned": "Pinned",
"Message": "Message",
"FlatList": "Flat list",
- "GroupedList": "Grouped list"
+ "GroupedList": "Grouped list",
+ "ArchiveAll": "Archive all"
}
}
diff --git a/plugins/notification-assets/lang/ru.json b/plugins/notification-assets/lang/ru.json
index 0688ef3b0c..e2512a42cf 100644
--- a/plugins/notification-assets/lang/ru.json
+++ b/plugins/notification-assets/lang/ru.json
@@ -35,6 +35,7 @@
"Pinned": "Закреплено",
"Message": "Сообщение",
"FlatList": "Flat list",
- "GroupedList": "Grouped list"
+ "GroupedList": "Grouped list",
+ "ArchiveAll": "Архивировать все"
}
}
diff --git a/plugins/notification-resources/src/components/Filter.svelte b/plugins/notification-resources/src/components/Filter.svelte
index 0eee679f27..1d7bad345a 100644
--- a/plugins/notification-resources/src/components/Filter.svelte
+++ b/plugins/notification-resources/src/components/Filter.svelte
@@ -13,7 +13,7 @@
// limitations under the License.
-->
-
+
diff --git a/plugins/notification-resources/src/components/inbox/Inbox.svelte b/plugins/notification-resources/src/components/inbox/Inbox.svelte
index a7df9c10a1..b8dbdf307a 100644
--- a/plugins/notification-resources/src/components/inbox/Inbox.svelte
+++ b/plugins/notification-resources/src/components/inbox/Inbox.svelte
@@ -31,7 +31,8 @@
Separator,
TabItem,
TabList,
- Location
+ Location,
+ ModernButton
} from '@hcengineering/ui'
import chunter, { ThreadMessage } from '@hcengineering/chunter'
import { Ref, WithLookup } from '@hcengineering/core'
@@ -255,6 +256,10 @@
onMount(() => {
loadSavedMessages()
})
+
+ function archiveAll (): void {
+ void inboxClient.deleteAllNotifications()
+ }
+
diff --git a/plugins/notification-resources/src/inboxNotificationsClient.ts b/plugins/notification-resources/src/inboxNotificationsClient.ts
index 24833b8c8e..cddce3e17b 100644
--- a/plugins/notification-resources/src/inboxNotificationsClient.ts
+++ b/plugins/notification-resources/src/inboxNotificationsClient.ts
@@ -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([])
@@ -250,4 +251,19 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
await client.remove(notification)
}
}
+
+ async deleteAllNotifications (): Promise {
+ 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()
+ }
+ }
}
diff --git a/plugins/notification/src/index.ts b/plugins/notification/src/index.ts
index b723fe55cc..0b1d098fc7 100644
--- a/plugins/notification/src/index.ts
+++ b/plugins/notification/src/index.ts
@@ -282,6 +282,7 @@ export interface InboxNotificationsClient {
readNotifications: (client: TxOperations, ids: Array[>) => Promise
unreadNotifications: (client: TxOperations, ids: Array][>) => Promise
deleteNotifications: (client: TxOperations, ids: Array][>) => Promise
+ deleteAllNotifications: () => Promise
}
/**
@@ -388,7 +389,8 @@ const notification = plugin(notificationId, {
Pinned: '' as IntlString,
FlatList: '' as IntlString,
GroupedList: '' as IntlString,
- All: '' as IntlString
+ All: '' as IntlString,
+ ArchiveAll: '' as IntlString
},
function: {
GetInboxNotificationsClient: '' as Resource,
]