fix: group info get is empty when user not in this group.

This commit is contained in:
Gordon
2024-06-27 11:34:04 +08:00
parent 0e64d54534
commit b162725bd6
3 changed files with 29 additions and 18 deletions

View File

@@ -73,7 +73,7 @@ func (c *Conversation) doNotificationNew(c2v common.Cmd2Value) {
}
syncFunctions := []func(c context.Context) error{
c.group.SyncAllJoinedGroupsAndMembers, c.friend.IncrSyncFriends,
c.group.SyncAllJoinedGroupsAndMembers, c.friend.IncrSyncFriends, c.SyncAllConversations,
}
for _, syncFunc := range syncFunctions {
@@ -92,7 +92,6 @@ func (c *Conversation) doNotificationNew(c2v common.Cmd2Value) {
case constant.MsgSyncEnd:
log.ZDebug(ctx, "MsgSyncEnd", "time", time.Since(c.startTime).Milliseconds())
defer c.ConversationListener().OnSyncServerFinish()
go c.SyncAllConversations(ctx)
}
for conversationID, msgs := range allMsg {

View File

@@ -26,7 +26,7 @@ import (
"github.com/openimsdk/tools/log"
)
func (c *Conversation) SyncConversationsAndTriggerCallback(ctx context.Context, conversationsOnServer []*model_struct.LocalConversation) error {
func (c *Conversation) SyncConversationsAndTriggerCallback(ctx context.Context, conversationsOnServer []*model_struct.LocalConversation, skipNotice bool) error {
conversationsOnLocal, err := c.db.GetAllConversations(ctx)
if err != nil {
return err
@@ -39,7 +39,7 @@ func (c *Conversation) SyncConversationsAndTriggerCallback(ctx context.Context,
c.doUpdateConversation(common.Cmd2Value{Value: common.UpdateConNode{ConID: server.ConversationID, Action: constant.ConChange, Args: []string{server.ConversationID}}})
}
return nil
}, true); err != nil {
}, true, skipNotice); err != nil {
return err
}
return nil
@@ -50,7 +50,7 @@ func (c *Conversation) SyncConversations(ctx context.Context, conversationIDs []
if err != nil {
return err
}
return c.SyncConversationsAndTriggerCallback(ctx, conversationsOnServer)
return c.SyncConversationsAndTriggerCallback(ctx, conversationsOnServer, false)
}
func (c *Conversation) SyncAllConversations(ctx context.Context) error {
@@ -60,7 +60,7 @@ func (c *Conversation) SyncAllConversations(ctx context.Context) error {
return err
}
log.ZDebug(ctx, "get server cost time", "cost time", time.Since(ccTime), "conversation on server", conversationsOnServer)
return c.SyncConversationsAndTriggerCallback(ctx, conversationsOnServer)
return c.SyncConversationsAndTriggerCallback(ctx, conversationsOnServer, true)
}
func (c *Conversation) SyncAllConversationHashReadSeqs(ctx context.Context) error {