feat: mark related message notifications as read when updating conversation unread count
This commit is contained in:
@@ -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