fix push online and offline user, but why typing trigger callback push?

pull/1681/head
AndrewZuo01 2 years ago
parent e31c6c2ce8
commit 75414a52f8

@ -101,10 +101,6 @@ func (p *Pusher) DeleteMemberAndSetConversationSeq(ctx context.Context, groupID
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
// callback
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
return err
}
// push
wsResults, err := p.GetConnsAndOnlinePush(ctx, msg, userIDs)
@ -120,7 +116,11 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
}
for _, v := range wsResults {
if msg.SendID != v.UserID && (!v.OnlinePush) {
if msg.SendID == v.UserID {
continue // Skip if sender and receiver are the same
}
if !v.OnlinePush {
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
return err
}
@ -129,7 +129,12 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
if err != nil {
return err
}
} else {
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
return err
}
}
}
return nil
}

Loading…
Cancel
Save