feat: include agentProfileId in connection response notifications to enable direct navigation to agent profiles
This commit is contained in:
@@ -315,6 +315,7 @@ export class ConnectionRequestsService {
|
||||
this.eventEmitter.emit('notification.connection_response', {
|
||||
recipientUserId: request.userId,
|
||||
agentName,
|
||||
agentProfileId,
|
||||
status: dto.status,
|
||||
connectionRequestId: requestId,
|
||||
});
|
||||
|
||||
@@ -543,12 +543,20 @@ export class NotificationsService implements OnModuleInit {
|
||||
async handleConnectionResponseNotification(event: {
|
||||
recipientUserId: string;
|
||||
agentName: string;
|
||||
agentProfileId?: string;
|
||||
status: string;
|
||||
connectionRequestId: string;
|
||||
}) {
|
||||
const isAccepted = event.status === 'ACCEPTED';
|
||||
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
|
||||
this.messagesGateway.sendToUser(event.recipientUserId, 'connection_response', {
|
||||
|
||||
Reference in New Issue
Block a user