fix(channels/dingtalk): prioritize senderStaffId over senderId for allowedUsers matching (#3294)

DingTalk provides two user identifiers: `senderId` (an internal platform ID
like `$:LWCP_v1:xxx`) and `senderStaffId` (the human-readable staff/employee
ID). The current code uses `senderId` first when constructing the Envelope,
which means `allowedUsers` configuration cannot match against the staff ID
that users actually know and configure.

Swap the priority so `senderStaffId` is preferred when available, falling back
to `senderId` only when `senderStaffId` is absent.

Made-with: Cursor
This commit is contained in:
易良 2026-04-15 22:34:08 +08:00 committed by GitHub
parent f6271c61b6
commit 0ca2d23103
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -534,7 +534,7 @@ export class DingtalkChannel extends ChannelBase {
const envelope: Envelope = {
channelName: this.name,
senderId: data.senderId || data.senderStaffId || '',
senderId: data.senderStaffId || data.senderId || '',
senderName: data.senderNick || 'Unknown',
chatId,
text: cleanText || content.text,