fix(feishu): accept nested schema 2 card identity · openclaw/openclaw@b5fd7a4
rubencu
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -194,6 +194,16 @@ function firstString(...values: unknown[]): string | undefined {
|
194 | 194 | return undefined; |
195 | 195 | } |
196 | 196 | |
| 197 | +function readFeishuIdentityField( |
| 198 | +value: unknown, |
| 199 | +field: "open_id" | "user_id" | "union_id", |
| 200 | +): string | undefined { |
| 201 | +if (!isRecord(value)) { |
| 202 | +return undefined; |
| 203 | +} |
| 204 | +return firstString(value[field]); |
| 205 | +} |
| 206 | + |
197 | 207 | function parseFeishuCardActionEventPayload(value: unknown): FeishuCardActionEvent | null { |
198 | 208 | if (!isRecord(value)) { |
199 | 209 | return null; |
@@ -204,10 +214,24 @@ function parseFeishuCardActionEventPayload(value: unknown): FeishuCardActionEven
|
204 | 214 | if (!isRecord(action)) { |
205 | 215 | return null; |
206 | 216 | } |
| 217 | +const operatorUserId = operator.user_id; |
207 | 218 | const token = readString(value.token); |
208 | | -const openId = firstString(operator.open_id, value.open_id, context.open_id); |
209 | | -const userId = firstString(operator.user_id, value.user_id, context.user_id); |
210 | | -const unionId = firstString(operator.union_id); |
| 219 | +const openId = firstString( |
| 220 | +operator.open_id, |
| 221 | +readFeishuIdentityField(operatorUserId, "open_id"), |
| 222 | +value.open_id, |
| 223 | +context.open_id, |
| 224 | +); |
| 225 | +const userId = firstString( |
| 226 | +operator.user_id, |
| 227 | +readFeishuIdentityField(operatorUserId, "user_id"), |
| 228 | +value.user_id, |
| 229 | +context.user_id, |
| 230 | +); |
| 231 | +const unionId = firstString( |
| 232 | +operator.union_id, |
| 233 | +readFeishuIdentityField(operatorUserId, "union_id"), |
| 234 | +); |
211 | 235 | const tag = readString(action.tag); |
212 | 236 | const actionValue = action.value; |
213 | 237 | const openMessageId = firstString(value.open_message_id, context.open_message_id); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。