mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-17 03:27:02 +08:00
Initialize Online field and reintroduce checks in SetConversations
This commit is contained in:
parent
89a8428afd
commit
d2ec39ed7e
@ -64,6 +64,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
||||
conversationNotificationSender: notification.NewConversationNotificationSender(&msgRpcClient),
|
||||
groupRpcClient: &groupRpcClient,
|
||||
conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewGorm(db)),
|
||||
Online: false,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@ -122,19 +123,19 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbConver
|
||||
}
|
||||
if req.Conversation.ConversationType == constant.GroupChatType {
|
||||
groupInfo, err := c.groupRpcClient.GetGroupInfo(ctx, req.Conversation.GroupID)
|
||||
func (c *conversationServer) SetConversations(ctx context.Context, req *pbConversation.SetConversationsReq) (*pbConversation.SetConversationsResp, error) {
|
||||
if req.Conversation == nil {
|
||||
return nil, errs.ErrArgs.Wrap("conversation must not be nil")
|
||||
}
|
||||
if req.Conversation.ConversationType == constant.GroupChatType {
|
||||
groupInfo, err := c.groupRpcClient.GetGroupInfo(ctx, req.Conversation.GroupID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if groupInfo.Status == constant.GroupStatusDismissed {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if groupInfo.Status == constant.GroupStatusDismissed {
|
||||
return nil, err
|
||||
}
|
||||
for _, userID := range req.UserIDs {
|
||||
if _, err := c.groupRpcClient.GetGroupMemberCache(ctx, req.Conversation.GroupID, userID); err != nil {
|
||||
log.ZError(ctx, "user not in group", err, "userID", userID, "groupID", req.Conversation.GroupID)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
var conversation tableRelation.ConversationModel
|
||||
conversation.ConversationID = req.Conversation.ConversationID
|
||||
conversation.ConversationType = req.Conversation.ConversationType
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user