From f34cb46ba284c8b0aebf5862499f4d039a33640b Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Wed, 16 Oct 2024 17:06:27 +0800 Subject: [PATCH] fix: update user --- pkg/common/db/model/chat/credential.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/common/db/model/chat/credential.go b/pkg/common/db/model/chat/credential.go index 7564c45e..5a389b3e 100644 --- a/pkg/common/db/model/chat/credential.go +++ b/pkg/common/db/model/chat/credential.go @@ -2,14 +2,13 @@ package chat import ( "context" - "go.mongodb.org/mongo-driver/mongo/options" - "github.com/openimsdk/chat/pkg/common/db/table/chat" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" ) func NewCredential(db *mongo.Database) (chat.CredentialInterface, error) { @@ -128,6 +127,9 @@ func (o *Credential) Delete(ctx context.Context, userIDs []string) error { } func (o *Credential) DeleteByUserIDType(ctx context.Context, credentials ...*chat.Credential) error { + if len(credentials) == 0 { + return nil + } var filters []bson.M for _, credential := range credentials { filters = append(filters, bson.M{