mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-25 19:15:03 +02:00
Chat fixes (#4947)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -258,9 +258,14 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
|
||||
try {
|
||||
const inboxNotifications = get(this.inboxNotifications) ?? []
|
||||
const contexts = get(this.docNotifyContexts) ?? []
|
||||
for (const notification of inboxNotifications) {
|
||||
await ops.remove(notification)
|
||||
}
|
||||
|
||||
for (const context of contexts) {
|
||||
await ops.update(context, { lastViewedTimestamp: Date.now() })
|
||||
}
|
||||
} finally {
|
||||
await ops.commit()
|
||||
await doneOp()
|
||||
@@ -273,11 +278,15 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
|
||||
try {
|
||||
const inboxNotifications = get(this.inboxNotifications) ?? []
|
||||
const contexts = get(this.docNotifyContexts) ?? []
|
||||
for (const notification of inboxNotifications) {
|
||||
if (!notification.isViewed) {
|
||||
await ops.update(notification, { isViewed: true })
|
||||
}
|
||||
}
|
||||
for (const context of contexts) {
|
||||
await ops.update(context, { lastViewedTimestamp: Date.now() })
|
||||
}
|
||||
} finally {
|
||||
await ops.commit()
|
||||
await doneOp()
|
||||
@@ -290,11 +299,16 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
|
||||
try {
|
||||
const inboxNotifications = get(this.inboxNotifications) ?? []
|
||||
const contexts = get(this.docNotifyContexts) ?? []
|
||||
|
||||
for (const notification of inboxNotifications) {
|
||||
if (notification.isViewed) {
|
||||
await ops.update(notification, { isViewed: false })
|
||||
}
|
||||
}
|
||||
for (const context of contexts) {
|
||||
await ops.update(context, { lastViewedTimestamp: 0 })
|
||||
}
|
||||
} finally {
|
||||
await ops.commit()
|
||||
await doneOp()
|
||||
|
||||
Reference in New Issue
Block a user