From 1f8bcbb559065e398d79db5fafb9bf031cc47f6c Mon Sep 17 00:00:00 2001 From: viettranx Date: Mon, 9 Mar 2026 09:44:28 +0700 Subject: [PATCH] fix(pairing): pass senderID to approve callback for group pairings --- internal/gateway/methods/pairing.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/gateway/methods/pairing.go b/internal/gateway/methods/pairing.go index 85f6bbb6..9b1b3e44 100644 --- a/internal/gateway/methods/pairing.go +++ b/internal/gateway/methods/pairing.go @@ -11,8 +11,9 @@ import ( ) // PairingApproveCallback is called after a pairing is approved. -// channel is the channel name (e.g., "telegram"), chatID is the chat to notify. -type PairingApproveCallback func(ctx context.Context, channel, chatID string) +// channel is the channel name (e.g., "telegram"), chatID is the chat to notify, +// senderID identifies the paired entity (e.g., "group:XXXX" for group pairings). +type PairingApproveCallback func(ctx context.Context, channel, chatID, senderID string) // PairingMethods handles device.pair.request, device.pair.approve, device.pair.list, device.pair.revoke. type PairingMethods struct { @@ -102,7 +103,7 @@ func (m *PairingMethods) handleApprove(ctx context.Context, client *gateway.Clie // Notify the user via channel (matching TS notifyPairingApproved). // Use Background context: the CLI client may disconnect before the notification is sent. if m.onApprove != nil && paired != nil { - go m.onApprove(context.Background(), paired.Channel, paired.ChatID) + go m.onApprove(context.Background(), paired.Channel, paired.ChatID, paired.SenderID) } if m.broadcaster != nil {