Add confirmation modal for archive all and add read all option (#4880)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-03-05 20:02:52 +07:00
committed by GitHub
parent 2732756b76
commit e0fb65ab47
7 changed files with 99 additions and 23 deletions
@@ -266,4 +266,21 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
await doneOp()
}
}
async readAllNotifications (): Promise<void> {
const doneOp = await getClient().measure('readAllNotifications')
const ops = getClient().apply(generateId())
try {
const inboxNotifications = get(this.inboxNotifications) ?? []
for (const notification of inboxNotifications) {
if (!notification.isViewed) {
await ops.update(notification, { isViewed: true })
}
}
} finally {
await ops.commit()
await doneOp()
}
}
}