feat: implement conversation mute and favorite functionality with corresponding notification suppression.
This commit is contained in:
@@ -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}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user