From eae79d567cad1e31d84b64b3ece29487a4d8eca3 Mon Sep 17 00:00:00 2001 From: withchao <48119764+withchao@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:43:32 +0800 Subject: [PATCH] fix: user offline push (#1015) * fix: create group type limit * fix: group notification * fix: group notification * fix: group notification * chore: group member hash * chore: group member hash * chore: group member hash * chore: group member hash * test: log * test: log * test: log * test: log * test: log * sync: hash code * sync: hash code * sync: hash code * test: log * test: log * test: log * test: log * test: log * fix: time stamp * fix: minio sign endpoint opts * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: minio bucket url * fix: op user info * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Conversation * fix: importFriends Notification * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Notification * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * TransferGroupOwner del group hash * add GetSpecifiedFriendsInfo * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * remove pprop * chore: optimize modification and send notifications * chore: optimize modification and send notifications * fix: repeated modification session notification * fix: repeated modification session notification * fix: jpush return a nil pointer panic * fix: user offline push * fix: user offline push --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: withchao --- internal/push/push_to_client.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index de0ecc192..690cd37f8 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -107,20 +107,17 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg isOfflinePush := utils.GetSwitchFromOptions(msg.Options, constant.IsOfflinePush) log.ZDebug(ctx, "push_result", "ws push result", wsResults, "sendData", msg, "isOfflinePush", isOfflinePush, "push_to_userID", userIDs) p.successCount++ - for _, userID := range userIDs { - if isOfflinePush && userID != msg.SendID { - // save invitation info for offline push - for _, v := range wsResults { - if v.OnlinePush { - return nil + if isOfflinePush { + for _, v := range wsResults { + if msg.SendID != v.UserID && (!v.OnlinePush) { + if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil { + return err } - } - if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil { - return err - } - err = p.offlinePushMsg(ctx, userID, msg, userIDs) - if err != nil { - return err + err = p.offlinePushMsg(ctx, msg.SendID, msg, []string{v.UserID}) + if err != nil { + return err + } + break } } }