fix(protocol): record inviter identity for uid-bearing group_invite
A group_invite carrying a fromUid is routed to the async dispatchGroupInvite enrich path, which only resolved the requester profile when needsProfile (uin missing/polluted) — so when the uin was already known it bypassed the synchronous rememberRequestIdentity that friend_request uses, and the inviter's uid↔uin was never stored. Record it up-front (mirrors the sync path), and re-record after a profile resolve so a previously-unknown uin self-heals. Fixes the long-standing bridge-member-identity test failure (core now fully green: 387 passed).
This commit is contained in:
1 file changed
+20
@@ -163,6 +163,19 @@ export class IncomingPacketPipeline {
|
|||||||
private async dispatchGroupInvite(event: Extract<QQEventVariant, { kind: 'group_invite' }>): Promise<void> {
|
private async dispatchGroupInvite(event: Extract<QQEventVariant, { kind: 'group_invite' }>): Promise<void> {
|
||||||
const uid = event.fromUid;
|
const uid = event.fromUid;
|
||||||
if (uid) {
|
if (uid) {
|
||||||
|
// Record the requester's identity up-front (synchronously), mirroring the
|
||||||
|
// friend_request path — uid-bearing group_invites take this async branch
|
||||||
|
// and would otherwise never store the inviter's uid↔uin when the uin is
|
||||||
|
// already known (needsProfile=false). uin equal to the group's own uin is
|
||||||
|
// the legacy decoder-pollution signature → pass 0 so the map write is
|
||||||
|
// skipped (rememberUidUin short-circuits on uin <= 0).
|
||||||
|
this.deps.identity.rememberRequestIdentity({
|
||||||
|
groupId: event.groupId,
|
||||||
|
uid,
|
||||||
|
uin: event.fromUin > 0 && event.fromUin !== event.groupId ? event.fromUin : 0,
|
||||||
|
source: 'group_request',
|
||||||
|
});
|
||||||
|
|
||||||
const subType = event.subType === 'invite' ? 'invite' : 'add';
|
const subType = event.subType === 'invite' ? 'invite' : 'add';
|
||||||
// ALWAYS fetch the verify comment (it's never in the push). Resolve
|
// ALWAYS fetch the verify comment (it's never in the push). Resolve
|
||||||
// the UID→UIN profile only when the requester isn't already known —
|
// the UID→UIN profile only when the requester isn't already known —
|
||||||
@@ -180,6 +193,13 @@ export class IncomingPacketPipeline {
|
|||||||
if (needsProfile) {
|
if (needsProfile) {
|
||||||
if (profileR.status === 'fulfilled' && profileR.value && profileR.value.uin > 0) {
|
if (profileR.status === 'fulfilled' && profileR.value && profileR.value.uin > 0) {
|
||||||
event.fromUin = profileR.value.uin;
|
event.fromUin = profileR.value.uin;
|
||||||
|
// uin was unknown/polluted at entry; now resolved → self-heal the map.
|
||||||
|
this.deps.identity.rememberRequestIdentity({
|
||||||
|
groupId: event.groupId,
|
||||||
|
uid,
|
||||||
|
uin: event.fromUin,
|
||||||
|
source: 'group_request',
|
||||||
|
});
|
||||||
} else if (profileR.status === 'rejected') {
|
} else if (profileR.status === 'rejected') {
|
||||||
this.log.warn('failed to resolve stranger profile: uid=%s err=%s',
|
this.log.warn('failed to resolve stranger profile: uid=%s err=%s',
|
||||||
uid, profileR.reason instanceof Error ? profileR.reason.message : String(profileR.reason));
|
uid, profileR.reason instanceof Error ? profileR.reason.message : String(profileR.reason));
|
||||||
|
|||||||
Reference in new issue
Block a user