feat: implement conversation mute and favorite functionality with corresponding notification suppression.

This commit is contained in:
pradeepkumar
2026-03-19 17:04:02 +05:30
parent 870eb0c067
commit fcf90e8638
4 changed files with 108 additions and 0 deletions

View File

@@ -347,6 +347,18 @@ export class NotificationsService implements OnModuleInit {
messagePreview: string;
conversationId: string;
}) {
// Check if the recipient has muted this conversation
const conversation = await this.prisma.conversation.findUnique({
where: { id: event.conversationId },
include: { agentProfile: { select: { userId: true } } },
});
if (conversation) {
const isUser = conversation.userId === event.recipientUserId;
const isMuted = isUser ? conversation.userMuted : conversation.agentMuted;
if (isMuted) return; // Skip notification for muted conversations
}
const prefix = await this.getRoutePrefix(event.recipientUserId);
const actionUrl = `${prefix}/message?conversationId=${event.conversationId}`;