Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Add a threshhold for updating last seen at in user nodes
Hakan Shehu981a31f3e2b1
diff --git a/apps/desktop/src/main/mutations/mark-node-as-seen.ts b/apps/desktop/src/main/mutations/mark-node-as-seen.tsindex 66504411..b1490408 100644--- a/apps/desktop/src/main/mutations/mark-node-as-seen.ts+++ b/apps/desktop/src/main/mutations/mark-node-as-seen.ts@@ -18,6 +18,26 @@ export class MarkNodeAsSeenMutationHandlerinput.userId);+ const existingUserNode = await workspaceDatabase+ .selectFrom('user_nodes')+ .where('node_id', '=', input.nodeId)+ .where('user_id', '=', input.userId)+ .selectAll()+ .executeTakeFirst();++ if (+ existingUserNode &&+ existingUserNode.last_seen_version_id === input.versionId+ ) {+ const lastSeenAt = new Date(existingUserNode.last_seen_at);+ // if has been seen in the last 10 minutes, skip it. We don't want to spam the server with seen events.+ if (Date.now() - lastSeenAt.getTime() < 10 * 60 * 1000) {+ return {+ success: true,+ };+ }+ }+let changeId: number | undefined;let userNode: UserNode | undefined;