mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-03 00:28:47 +02:00
Create global inbox actions (#4903)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -283,4 +283,21 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
await doneOp()
|
||||
}
|
||||
}
|
||||
|
||||
async unreadAllNotifications (): Promise<void> {
|
||||
const doneOp = await getClient().measure('unreadAllNotifications')
|
||||
const ops = getClient().apply(generateId())
|
||||
|
||||
try {
|
||||
const inboxNotifications = get(this.inboxNotifications) ?? []
|
||||
for (const notification of inboxNotifications) {
|
||||
if (notification.isViewed) {
|
||||
await ops.update(notification, { isViewed: false })
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await ops.commit()
|
||||
await doneOp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user