Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

don't expose anon chats to project owners

Blue Mouse90ddc572e2ee
diff --git a/backend/apps/cloud/src/ai/ai-chat.service.ts b/backend/apps/cloud/src/ai/ai-chat.service.ts
index d30832d0b..7a4056ec2 100644
--- a/backend/apps/cloud/src/ai/ai-chat.service.ts
+++ b/backend/apps/cloud/src/ai/ai-chat.service.ts
@@ -32,13 +32,10 @@ export class AiChatService {
const queryBuilder = this.aiChatRepository
.createQueryBuilder('chat')
.where('chat.projectId = :projectId', { projectId })
+ .andWhere('chat.userId = :userId', { userId })
.orderBy('chat.updated', 'DESC')
.take(limit)
- queryBuilder.andWhere('(chat.userId = :userId OR chat.userId IS NULL)', {
- userId,
- })
-
return queryBuilder.getMany()
}
@@ -56,14 +53,11 @@ export class AiChatService {
const queryBuilder = this.aiChatRepository
.createQueryBuilder('chat')
.where('chat.projectId = :projectId', { projectId })
+ .andWhere('chat.userId = :userId', { userId })
.orderBy('chat.updated', 'DESC')
.skip(skip)
.take(take)
- queryBuilder.andWhere('(chat.userId = :userId OR chat.userId IS NULL)', {
- userId,
- })
-
const [chats, total] = await queryBuilder.getManyAndCount()
return { chats, total }
}