fix(protocol): guard identity.findGroup in group decoder (#212)
9b470d0added ctx.identity.findGroup() to the group-message decoder for the group_name cache fallback, but several suites mock a minimal identity without findGroup, so decodeGroupMessage threw at runtime once the typecheck gate (fixed in5e73d69) let CI reach the test phase — forward / packet-pipeline-stranger-resolve / msg-push-handler. Optional-chain the call: the real IdentityService always has findGroup; only test mocks omit it, and an absent cache simply yields no fallback name.
This commit is contained in:
1 file changed
+1
-1
@@ -47,6 +47,6 @@ export const decodeGroupMessage: MsgPushDecoder = (ctx) => {
|
||||
// Group name: prefer the message's own wire field (ResponseGrp field 7 —
|
||||
// fresh even right after a rename), fall back to the cached group list, else
|
||||
// leave it empty. `ev.groupId` is set above from grp.groupUin.
|
||||
ev.groupName = grp?.groupName || ctx.identity.findGroup(ev.groupId)?.groupName || '';
|
||||
ev.groupName = grp?.groupName || ctx.identity.findGroup?.(ev.groupId)?.groupName || '';
|
||||
return [ev];
|
||||
};
|
||||
Reference in new issue
Block a user