From 09003bd4098380575b02f881b10c1bae65d847fd Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Fri, 10 Apr 2026 17:44:38 +0530 Subject: [PATCH] refactor: update deleteConversation to perform soft-delete without notifying other participants --- src/messages/messages.controller.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/messages/messages.controller.ts b/src/messages/messages.controller.ts index 89e4d16..36ffbfc 100644 --- a/src/messages/messages.controller.ts +++ b/src/messages/messages.controller.ts @@ -298,22 +298,9 @@ export class MessagesController { @Param('id') conversationId: string, @CurrentUser('id') userId: string, ) { - // Get the other party before deletion so we can notify them - const participants = await this.messagesService.getConversationParticipants(conversationId); - const result = await this.messagesService.deleteConversation(conversationId, userId); - - // Notify the other party so their client removes the stale conversation - if (participants) { - const otherUserId = userId === participants.userId - ? participants.agentUserId - : participants.userId; - this.messagesGateway.sendToUser(otherUserId, 'conversation_deleted', { - conversationId, - deletedBy: userId, - }); - } - - return result; + // Soft-delete: only hides the conversation for the requesting user. + // The other party is NOT notified — their view is unaffected. + return this.messagesService.deleteConversation(conversationId, userId); } // ==========================================