fix(social): friend_request_sent local broadcast must carry target profile
The local branch was reusing friendRequestPayload (built for friend_request_received with user=sender) for the sender-side friend_request_sent broadcast. Tab B on the sender would render the sender's own avatar where the target's should appear. Match the federated branch — sent broadcast carries target.
This commit is contained in:
@@ -236,5 +236,9 @@ describe('POST /api/social/requests — case-insensitive username lookup', () =>
|
||||
const sent = sendToUser.mock.calls.find(c => c[1]?.type === 'friend_request_sent');
|
||||
expect(sent).toBeDefined();
|
||||
expect(sent![0]).toBe(CALLER_ID);
|
||||
// The 'user' field on the sent payload must be the TARGET (alice),
|
||||
// not the sender — symmetric with how the federated branch builds it.
|
||||
expect(sent![1].request.user.id).toBe('u1');
|
||||
expect(sent![1].request.user.username).toBe('alice');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user