feat: include agentProfileId in connection response notifications to enable direct navigation to agent profiles

This commit is contained in:
pradeepkumar
2026-04-15 19:37:59 +05:30
parent 416257a881
commit ef52858990
2 changed files with 10 additions and 1 deletions

View File

@@ -315,6 +315,7 @@ export class ConnectionRequestsService {
this.eventEmitter.emit('notification.connection_response', { this.eventEmitter.emit('notification.connection_response', {
recipientUserId: request.userId, recipientUserId: request.userId,
agentName, agentName,
agentProfileId,
status: dto.status, status: dto.status,
connectionRequestId: requestId, connectionRequestId: requestId,
}); });

View File

@@ -543,12 +543,20 @@ export class NotificationsService implements OnModuleInit {
async handleConnectionResponseNotification(event: { async handleConnectionResponseNotification(event: {
recipientUserId: string; recipientUserId: string;
agentName: string; agentName: string;
agentProfileId?: string;
status: string; status: string;
connectionRequestId: string; connectionRequestId: string;
}) { }) {
const isAccepted = event.status === 'ACCEPTED'; const isAccepted = event.status === 'ACCEPTED';
const prefix = await this.getRoutePrefix(event.recipientUserId); const prefix = await this.getRoutePrefix(event.recipientUserId);
const actionUrl = isAccepted ? `${prefix}/message` : `${prefix}/profiles`; // When accepted, take the user directly to the agent's profile page.
// Fall back to messages view if we don't know the agentProfileId, and to
// the profiles list when declined.
const actionUrl = isAccepted
? event.agentProfileId
? `${prefix}/profile/${event.agentProfileId}`
: `${prefix}/message`
: `${prefix}/profiles`;
// Send real-time socket event so user sees response instantly // Send real-time socket event so user sees response instantly
this.messagesGateway.sendToUser(event.recipientUserId, 'connection_response', { this.messagesGateway.sendToUser(event.recipientUserId, 'connection_response', {