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),
|
conversationNotificationSender: notification.NewConversationNotificationSender(&msgRpcClient),
|
||||||
groupRpcClient: &groupRpcClient,
|
groupRpcClient: &groupRpcClient,
|
||||||
conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewGorm(db)),
|
conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewGorm(db)),
|
||||||
|
Online: false,
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -122,19 +123,19 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbConver
|
|||||||
}
|
}
|
||||||
if req.Conversation.ConversationType == constant.GroupChatType {
|
if req.Conversation.ConversationType == constant.GroupChatType {
|
||||||
groupInfo, err := c.groupRpcClient.GetGroupInfo(ctx, req.Conversation.GroupID)
|
groupInfo, err := c.groupRpcClient.GetGroupInfo(ctx, req.Conversation.GroupID)
|
||||||
func (c *conversationServer) SetConversations(ctx context.Context, req *pbConversation.SetConversationsReq) (*pbConversation.SetConversationsResp, error) {
|
if err != nil {
|
||||||
if req.Conversation == nil {
|
return nil, err
|
||||||
return nil, errs.ErrArgs.Wrap("conversation must not be nil")
|
}
|
||||||
}
|
if groupInfo.Status == constant.GroupStatusDismissed {
|
||||||
if req.Conversation.ConversationType == constant.GroupChatType {
|
return nil, err
|
||||||
groupInfo, err := c.groupRpcClient.GetGroupInfo(ctx, req.Conversation.GroupID)
|
}
|
||||||
if err != nil {
|
for _, userID := range req.UserIDs {
|
||||||
return nil, err
|
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)
|
||||||
if groupInfo.Status == constant.GroupStatusDismissed {
|
return nil, err
|
||||||
return nil, err
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var conversation tableRelation.ConversationModel
|
var conversation tableRelation.ConversationModel
|
||||||
conversation.ConversationID = req.Conversation.ConversationID
|
conversation.ConversationID = req.Conversation.ConversationID
|
||||||
conversation.ConversationType = req.Conversation.ConversationType
|
conversation.ConversationType = req.Conversation.ConversationType
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user