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:
Jannis Braun
2026-04-25 22:18:47 +02:00
parent 1ad1fd1b0c
commit d88d369a82
3 changed files with 28 additions and 11 deletions
@@ -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');
});
});