fix(pairing): pass senderID to approve callback for group pairings

This commit is contained in:
viettranx committed 2026-03-09 09:44:28 +07:00
1 parent f62f60b094
commit 1f8bcbb559
1 file changed
+4 -3
+4 -3
View File
@@ -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 {