feat: mark related message notifications as read when updating conversation unread count
This commit is contained in:
1 parent
02a1f15324
commit
d84e55cb61
1 file changed
+15
@@ -562,6 +562,21 @@ export class MessagesService {
|
||||
data: isUser ? { userUnreadCount: 0 } : { agentUnreadCount: 0 },
|
||||
});
|
||||
|
||||
// Also mark related message notifications as read for this user
|
||||
// Notifications store conversationId in the JSON `data` field
|
||||
await this.prisma.notification.updateMany({
|
||||
where: {
|
||||
userId,
|
||||
type: 'message',
|
||||
read: false,
|
||||
data: {
|
||||
path: ['conversationId'],
|
||||
equals: conversationId,
|
||||
},
|
||||
},
|
||||
data: { read: true },
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user