fix(forward): preserve group merged-forward sender nickname (#201)
get_forward_msg returned empty sender.nickname for group merged-forward nodes.
The reporter blamed a mis-parsed group_id + a failing member-list enrichment
(0xfe7_3 0x899_AUTHORITY_FAIL), but on-target capture shows a mislabeled proto
field: the group response-head's sender display name lives in field 4, which we
had labeled `groupName`. It's populated on live pushes ("星屿" / the group card
"墨梓柒111") AND on merged-forward nodes (per-node sender name), while field 2
(`memberName`) is empty on live/forward and only set by the group-history fetch,
and the real group name is field 7. Lagrange labels field 4 `MemberName`.
Relabel ResponseGrp: field 4 `memberCard` (sender display name = card||nick),
field 7 `groupName` (the real group name); keep field 2 `memberName` for the
group-history slot. The group decoder now resolves the sender name by priority:
field-2 name → local member cache (clean nick/card split) → field-4 memberCard.
The last step is what lets a forward node from a group the bot isn't in keep its
per-node sender name with no member-list lookup, so the forward-specific fallback
and the AUTHORITY_FAIL enrichment path are no longer needed for the common case.
Verified on-target across scenarios: live message senderNick unchanged; a plain
forward, a forward from a never-joined group (placeholder uin 1094950020, four
distinct senders 金橘雪梨/Crel/503/Xiing0), and a nested forward all keep their
nicknames; no member-list call fires. group_id stays the payload's value.
This commit is contained in:
4 files changed
+32
-19
No files matched your search
@@ -107,13 +107,12 @@ describe('actions/forward', () => {
|
||||
});
|
||||
|
||||
it('[#201] fills a group forward node nickname from grp.groupName when memberName is empty', async () => {
|
||||
// Real merged-forward nodes leave grp.memberName null and carry the sender
|
||||
// display name in grp.groupName (field 4). Verified on-target: fromUin
|
||||
// 1787882683 ↔ grp.groupName "墨梓柒", memberName null. Before the fix the
|
||||
// node nickname came back "" and enrichSenders 0x899-AUTHORITY_FAIL'd on the
|
||||
// placeholder source group.
|
||||
// Real merged-forward nodes leave grp.memberName (field 2) null and carry the
|
||||
// sender display name in grp.memberCard (field 4). Verified on-target: fromUin
|
||||
// 1787882683 ↔ grp.memberCard "墨梓柒". Before the fix the node nickname came
|
||||
// back "" and enrichSenders 0x899-AUTHORITY_FAIL'd on the placeholder group.
|
||||
const node: PushMsgBody = {
|
||||
responseHead: { fromUin: 1787882683, fromUid: 'u_x', grp: { groupUin: 284840486, groupName: '墨梓柒' } },
|
||||
responseHead: { fromUin: 1787882683, fromUid: 'u_x', grp: { groupUin: 284840486, memberCard: '墨梓柒' } },
|
||||
contentHead: { msgType: 82, sequence: 1, timestamp: 100 }, // 82 = PkgType.GroupMessage
|
||||
body: { richText: { elems: [{ text: { str: 'hi' } }] } },
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user