pull/3809/merge
皮皮萌宝 3 days ago committed by GitHub
commit 3f8148b3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -341,10 +341,19 @@ func (g *groupServer) webhookBeforeSetGroupInfo(ctx context.Context, before *con
if resp.ApplyMemberFriend != nil { if resp.ApplyMemberFriend != nil {
req.GroupInfoForSet.ApplyMemberFriend = wrapperspb.Int32(*resp.ApplyMemberFriend) req.GroupInfoForSet.ApplyMemberFriend = wrapperspb.Int32(*resp.ApplyMemberFriend)
} }
datautil.NotNilReplace(&req.GroupInfoForSet.GroupID, &resp.GroupID) // A zero value means the callback did not provide the field; keep the request value.
datautil.NotNilReplace(&req.GroupInfoForSet.GroupName, &resp.GroupName) if resp.GroupID != "" {
datautil.NotNilReplace(&req.GroupInfoForSet.FaceURL, &resp.FaceURL) req.GroupInfoForSet.GroupID = resp.GroupID
datautil.NotNilReplace(&req.GroupInfoForSet.Introduction, &resp.Introduction) }
if resp.GroupName != "" {
req.GroupInfoForSet.GroupName = resp.GroupName
}
if resp.FaceURL != "" {
req.GroupInfoForSet.FaceURL = resp.FaceURL
}
if resp.Introduction != "" {
req.GroupInfoForSet.Introduction = resp.Introduction
}
return nil return nil
}) })
} }
@ -405,14 +414,31 @@ func (g *groupServer) webhookBeforeSetGroupInfoEx(ctx context.Context, before *c
return err return err
} }
datautil.NotNilReplace(&req.GroupID, &resp.GroupID) // Only overwrite fields the callback explicitly provided, to avoid wiping the request's partial updates.
datautil.NotNilReplace(&req.GroupName, &resp.GroupName) if resp.GroupID != "" {
datautil.NotNilReplace(&req.FaceURL, &resp.FaceURL) req.GroupID = resp.GroupID
datautil.NotNilReplace(&req.Introduction, &resp.Introduction) }
datautil.NotNilReplace(&req.Ex, &resp.Ex) if resp.GroupName != nil {
datautil.NotNilReplace(&req.NeedVerification, &resp.NeedVerification) req.GroupName = resp.GroupName
datautil.NotNilReplace(&req.LookMemberInfo, &resp.LookMemberInfo) }
datautil.NotNilReplace(&req.ApplyMemberFriend, &resp.ApplyMemberFriend) if resp.FaceURL != nil {
req.FaceURL = resp.FaceURL
}
if resp.Introduction != nil {
req.Introduction = resp.Introduction
}
if resp.Ex != nil {
req.Ex = resp.Ex
}
if resp.NeedVerification != nil {
req.NeedVerification = resp.NeedVerification
}
if resp.LookMemberInfo != nil {
req.LookMemberInfo = resp.LookMemberInfo
}
if resp.ApplyMemberFriend != nil {
req.ApplyMemberFriend = resp.ApplyMemberFriend
}
return nil return nil
}) })

Loading…
Cancel
Save