This commit is contained in:
withchao 2023-05-10 15:47:15 +08:00
parent 20afd0a51f
commit ec5f617437

View File

@ -2,10 +2,9 @@ package controller
import ( import (
"context" "context"
"errors"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -49,14 +48,14 @@ func (b *blackDatabase) FindOwnerBlacks(ctx context.Context, ownerUserID string,
func (b *blackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) { func (b *blackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) {
_, err = b.black.Take(ctx, userID1, userID2) _, err = b.black.Take(ctx, userID1, userID2)
if err != nil { if err != nil {
if errors.Unwrap(err) != gorm.ErrRecordNotFound { if errs.Unwrap(err) != gorm.ErrRecordNotFound {
return return
} }
} }
inUser1Blacks = err == nil inUser1Blacks = err == nil
_, err = b.black.Take(ctx, userID2, userID1) _, err = b.black.Take(ctx, userID2, userID1)
if err != nil { if err != nil {
if utils.Unwrap(err) != gorm.ErrRecordNotFound { if errs.Unwrap(err) != gorm.ErrRecordNotFound {
return return
} }
} }