mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
feat: choose whether to push group messages offline based on the user's session option settings (#1054)
* fix: repeated modification session notification * fix: repeated modification session notification * fix: jpush return a nil pointer panic * fix: push redis pkg * fix: OANotification * feat: add rpc GetConversationNeedOfflinePushUserIDs * update pkg * cicd: robot automated Change * offlinePushMsg * conversation * conversation * cicd: robot automated Change * conversation * cicd: robot automated Change * conversation --------- Co-authored-by: withchao <withchao@users.noreply.github.com>
This commit is contained in:
@@ -300,3 +300,30 @@ func (c *conversationServer) GetConversationsByConversationID(
|
||||
}
|
||||
return &pbconversation.GetConversationsByConversationIDResp{Conversations: convert.ConversationsDB2Pb(conversations)}, nil
|
||||
}
|
||||
|
||||
func (c *conversationServer) GetConversationOfflinePushUserIDs(
|
||||
ctx context.Context,
|
||||
req *pbconversation.GetConversationOfflinePushUserIDsReq,
|
||||
) (*pbconversation.GetConversationOfflinePushUserIDsResp, error) {
|
||||
if req.ConversationID == "" {
|
||||
return nil, errs.ErrArgs.Wrap("conversationID is empty")
|
||||
}
|
||||
if len(req.UserIDs) == 0 {
|
||||
return &pbconversation.GetConversationOfflinePushUserIDsResp{}, nil
|
||||
}
|
||||
userIDs, err := c.conversationDatabase.GetConversationNotReceiveMessageUserIDs(ctx, req.ConversationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(userIDs) == 0 {
|
||||
return &pbconversation.GetConversationOfflinePushUserIDsResp{UserIDs: req.UserIDs}, nil
|
||||
}
|
||||
userIDSet := make(map[string]struct{})
|
||||
for _, userID := range req.UserIDs {
|
||||
userIDSet[userID] = struct{}{}
|
||||
}
|
||||
for _, userID := range userIDs {
|
||||
delete(userIDSet, userID)
|
||||
}
|
||||
return &pbconversation.GetConversationOfflinePushUserIDsResp{UserIDs: utils.Keys(userIDSet)}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user