Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Fix unread counts query

Hakan Shehu7d214b54a775
diff --git a/apps/desktop/src/main/handlers/queries/sidebar-chat-list.ts b/apps/desktop/src/main/handlers/queries/sidebar-chat-list.ts
index 89a82560..ada72eb4 100644
--- a/apps/desktop/src/main/handlers/queries/sidebar-chat-list.ts
+++ b/apps/desktop/src/main/handlers/queries/sidebar-chat-list.ts
@@ -163,7 +163,7 @@ export class SidebarChatListQueryHandler
.where('n.type', '=', NodeTypes.Message)
.where('n.parent_id', 'in', chatIds)
.where('un.last_seen_version_id', 'is', null)
- .select(['un.node_id'])
+ .select(['n.parent_id as node_id'])
.select((eb) => [
eb.fn.count<number>('un.node_id').as('unread_count'),
eb.fn.sum<number>('un.mentions_count').as('mentions_count'),
diff --git a/apps/desktop/src/main/handlers/queries/sidebar-space-list.ts b/apps/desktop/src/main/handlers/queries/sidebar-space-list.ts
index eb399b82..f337bb0a 100644
--- a/apps/desktop/src/main/handlers/queries/sidebar-space-list.ts
+++ b/apps/desktop/src/main/handlers/queries/sidebar-space-list.ts
@@ -125,7 +125,7 @@ export class SidebarSpaceListQueryHandler
.where('n.type', '=', NodeTypes.Message)
.where('n.parent_id', 'in', channelIds)
.where('un.last_seen_version_id', 'is', null)
- .select(['un.node_id'])
+ .select(['n.parent_id as node_id'])
.select((eb) => [
eb.fn.count<number>('un.node_id').as('unread_count'),
eb.fn.sum<number>('un.mentions_count').as('mentions_count'),